Code example for AbstractMap.SimpleImmutableEntry

Methods: getKey, getValue, hashCode

0
        Entry testEntry = new AbstractMap.SimpleImmutableEntry(entryToPut);
        assertEquals(entry,testEntry);
    } 
     
    public void test_SimpleImmutableEntry_hashCode() throws Exception { 
        Entry e = new AbstractMap.SimpleImmutableEntry<Integer, String>(1, "test");
        assertEquals((e.getKey() == null ? 0 : e.getKey().hashCode())
                ^ (e.getValue() == null ? 0 : e.getValue().hashCode()), e
                .hashCode());
    } 
     
    public void test_SimpleImmutableEntry_toString() throws Exception { 
        Entry e = new AbstractMap.SimpleImmutableEntry<Integer, String>(1, "test");
        assertEquals(e.getKey()+"="+e.getValue(),e.toString());
        Object array =Array.newInstance((byte[].class).getComponentType(), 10);
        assertEquals(10,((byte[])array).length);
    } 
     
    /** 
     * @tests serialization/deserialization. 
     */