package reflection;

import junit.UnitTestRunner;
import org.junit.Test;
import static org.junit.Assert.*;

public class ClassLoaderTest {
    
    public static void main(String[] args) {
        UnitTestRunner.run(ClassLoaderTest.class);
    }
    
    @Test
    public void sysClassLoader() {
        ClassLoader sysCl = ClassLoader.getSystemClassLoader();
        assertEquals("sun.misc.Launcher$AppClassLoader", sysCl.getClass().getName());
        
        ClassLoader extCl = sysCl.getParent();
        assertEquals("sun.misc.Launcher$ExtClassLoader", extCl.getClass().getName());
        
        ClassLoader bootCl = extCl.getParent();
        assertNull(bootCl);
    }
    
    @Test
    public void getClassLoader() {
        ClassLoader bootCl = Object.class.getClassLoader();
        assertNull(bootCl);
        
        ClassLoader appCl = ClassLoaderTest.class.getClassLoader();
        ClassLoader sysCl = ClassLoader.getSystemClassLoader();
        assertSame(sysCl, appCl);
    }
    
}

@@ -996,10 +996,303 @@
  %7D%0A    %0A
+    @Test%0A    public void loadClass() throws Exception %7B%0A        ClassLoader sysCl = ClassLoader.getSystemClassLoader();%0A        assertSame(Object.class, sysCl.loadClass(%22java.lang.Object%22));%0A        assertSame(ClassLoaderTest.class, sysCl.loadClass(%22reflection.ClassLoaderTest%22));%0A    %7D%0A    %0A
 %7D%0A

test loadClass()