Skip to content

Commit

Permalink
add ClassUtilTest (opengoofy#1318)
Browse files Browse the repository at this point in the history
  • Loading branch information
guanam authored May 22, 2023
1 parent a9ca0a7 commit fa122e4
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}

}

0 comments on commit fa122e4

Please sign in to comment.