Code example for HashMap

Methods: containsKeysize

0
    /** Finds a class we just preloaded. It should work. */ 
    public final void testFindClass_classFound() throws Exception { 
        Class<?> c = _findClass(mFrameworkClassLoader, "jar.example.Class2");  //$NON-NLS-1$
        assertEquals("jar.example.Class2", c.getName());              //$NON-NLS-1$
        HashMap<String, Class<?>> map = getPrivateClassCache();
        assertTrue(map.containsKey("jar.example.Class1"));            //$NON-NLS-1$
        assertTrue(map.containsKey("jar.example.Class2"));            //$NON-NLS-1$
        assertEquals(2, map.size());
    } 
     
    /** call the protected method findClass */ 
    private Class<?> _findClass(AndroidJarLoader jarLoader, String name) throws Exception {
        Method findClassMethod = AndroidJarLoader.class.getDeclaredMethod(
                "findClass", String.class);  //$NON-NLS-1$
        findClassMethod.setAccessible(true);
        try { 
            return (Class<?>)findClassMethod.invoke(jarLoader, name);
        } 
        catch (InvocationTargetException e) {
           throw (Exception)e.getCause();
Experience pair programming with AI  Get Codota for Java