Code example for AbstractMap.SimpleImmutableEntry

0
    /** 
     * @tests serialization/deserialization. 
     */ 
    @SuppressWarnings({ "unchecked", "boxing" }) 
    public void testSerializationSelf_SimpleImmutableEntry() throws Exception { 
        Entry e = new AbstractMap.SimpleImmutableEntry<Integer, String>(1, "test");
        SerializationTest.verifySelf(e);
    } 
 
    /** 
     * @tests serialization/deserialization compatibility with RI. 
     */ 
    @SuppressWarnings({ "unchecked", "boxing" }) 
    public void testSerializationCompatibility_SimpleImmutableEntry() throws Exception { 
        SimpleImmutableEntry e = new AbstractMap.SimpleImmutableEntry<Integer, String>(1, "test");        
        if (!(SerializationTester.readObject(e, "serialization/java/util/AbstractMapTest_SimpleImmutableEntry.golden.ser") instanceof SimpleImmutableEntry)){
            fail("should be SimpleImmutableEntry");
        } 
        SerializationTester.assertCompabilityEquals(e, "serialization/java/util/AbstractMapTest_SimpleImmutableEntry.golden.ser");        
    } 
}