mirror of https://github.com/longtai-cn/hippo4j
add ClassUtilTest (#1318)
parent
a9ca0a7b84
commit
fa122e4267
@ -0,0 +1,27 @@
|
||||
package cn.hippo4j.common.toolkit;
|
||||
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* test for {@link ClassUtil}
|
||||
*/
|
||||
public class ClassUtilTest {
|
||||
|
||||
@Test
|
||||
public void testGetClassLoader(){
|
||||
ClassLoader expectedClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
ClassLoader actualClassLoader = ClassUtil.getClassLoader(ClassUtilTest.class);
|
||||
Assert.assertEquals(expectedClassLoader, actualClassLoader);
|
||||
|
||||
expectedClassLoader = ClassUtilTest.class.getClassLoader();
|
||||
actualClassLoader = ClassUtil.getClassLoader(null);
|
||||
Assert.assertEquals(expectedClassLoader, actualClassLoader);
|
||||
|
||||
expectedClassLoader = ClassLoader.getSystemClassLoader();
|
||||
actualClassLoader = ClassUtil.getClassLoader(String.class);
|
||||
Assert.assertEquals(expectedClassLoader, actualClassLoader);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue