FileDocCategorySizeDatePackage
ClassLoaderTest.javaAPI DocAndroid 1.5 API11876Wed May 06 22:42:02 BST 2009android.core

ClassLoaderTest

public class ClassLoaderTest extends TestCase
Test for basic ClassLoader functionality.

Fields Summary
private static byte[]
test1class
private static byte[]
test2class
Constructors Summary
Methods Summary
private static voidmethodTest(java.lang.Class clazz, java.lang.String expect)

        Method meth = clazz.getMethod("test", (Class[]) null);
        Object obj = clazz.newInstance();
        Object result = meth.invoke(obj, (Object[]) null);

        assertEquals(result, expect);
    
public voidtestClassLoader()

        Class test1, test2;
        MyLoader loader1 = new MyLoader(test1class);
        MyLoader loader2 = new MyLoader(test2class);

        test1 = loader1.loadClass("my.pkg.CLTest");
        test2 = loader2.loadClass("my.pkg.CLTest");

        methodTest(test1, "This is test 1");
        methodTest(test2, "This is test 2");