Code example for HashMap

Methods: containsKey, size

0
    public final void testPreLoadClasses() throws Exception { 
        mFrameworkClassLoader.preLoadClasses("jar.example.", null, null); //$NON-NLS-1$
        HashMap<String, Class<?>> map = getPrivateClassCache();
        assertEquals(0, map.size());
        HashMap<String,byte[]> data = getPrivateEntryCache();
        assertTrue(data.containsKey("jar.example.Class1"));                    //$NON-NLS-1$
        assertTrue(data.containsKey("jar.example.Class2"));                    //$NON-NLS-1$
        assertTrue(data.containsKey("jar.example.Class1$InnerStaticClass1"));  //$NON-NLS-1$
        assertTrue(data.containsKey("jar.example.Class1$InnerClass2"));  //$NON-NLS-1$
        assertEquals(4, data.size());
    } 
 
    /** Preloads a class not in the JAR. Preloading does nothing in this case. */ 
    public final void testPreLoadClasses_classNotFound() throws Exception { 
        mFrameworkClassLoader.preLoadClasses("not.a.package.", null, null);  //$NON-NLS-1$
        HashMap<String, Class<?>> map = getPrivateClassCache();
        assertEquals(0, map.size());
        HashMap<String,byte[]> data = getPrivateEntryCache();
        assertEquals(0, data.size());
    }