public class ClassUtilsTest {
@Test
public void testParentLastClassLoading() throws Exception {
Resource jar = new DefaultResourceLoader().getResource("class-v1.jar");
SomeClass v2 = new SomeClass();
assertEquals("Class-v2", System.getProperty(SomeClass.LAST_LOADED));
assertNotNull(System.getProperty(SomeClass.CLASS_LOADED + ".2"));
// use v2 CL as a parent
Object obj = loadFromJar(jar, v2.getClass().getClassLoader(), "test.SomeClass");
// check the jar classes are preferred
assertEquals("Class-v1", System.getProperty(SomeClass.LAST_LOADED));
assertNotNull(System.getProperty(SomeClass.CLASS_LOADED + ".1"));
assertFalse(v2.getClass().equals(obj.getClass()));
}