Code example for IdentityHashMap

0
    /** 
     * java.util.IdentityHashMap#IdentityHashMap() 
     */ 
    public void test_Constructor() { 
        // Test for method java.util.IdentityHashMap() 
        new Support_MapTest2(new IdentityHashMap()).runTest();
 
        IdentityHashMap hm2 = new IdentityHashMap();
        assertEquals("Created incorrect IdentityHashMap", 0, hm2.size());
    } 
 
    /** 
     * java.util.IdentityHashMap#IdentityHashMap(int) 
     */ 
    public void test_ConstructorI() { 
        // Test for method java.util.IdentityHashMap(int) 
        IdentityHashMap hm2 = new IdentityHashMap(5);
        assertEquals("Created incorrect IdentityHashMap", 0, hm2.size());
        try { 
            new IdentityHashMap(-1);
            fail("Failed to throw IllegalArgumentException for initial capacity < 0");