diff --git a/src/test/org/apache/commons/collections/TestSequencedHashMap.java b/src/test/org/apache/commons/collections/TestSequencedHashMap.java index 30f146ffe..a722cce3e 100644 --- a/src/test/org/apache/commons/collections/TestSequencedHashMap.java +++ b/src/test/org/apache/commons/collections/TestSequencedHashMap.java @@ -54,6 +54,8 @@ package org.apache.commons.collections; * . */ +import java.io.IOException; +import java.io.Serializable; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -177,6 +179,28 @@ implements TestMap.SupportsPut, TestMap.EntrySetSupportsRemove assertTrue("second key is reassigned to first",labRat.get(0).equals(new Integer(2))); } + // override TestMap method with more specific tests + public void testFullMapSerialization() + throws IOException, ClassNotFoundException { + SequencedHashMap map = (SequencedHashMap) makeFullMap(); + if (!(map instanceof Serializable)) return; + + byte[] objekt = writeExternalFormToBytes((Serializable) map); + SequencedHashMap map2 = (SequencedHashMap) readExternalFormFromBytes(objekt); + + assertEquals("Both maps are same size",map.size(), getSampleKeys().length); + assertEquals("Both maps are same size",map2.size(),getSampleKeys().length); + + assertEquals("Both maps have the same first key", + map.getFirstKey(),getSampleKeys()[0]); + assertEquals("Both maps have the same first key", + map2.getFirstKey(),getSampleKeys()[0]); + assertEquals("Both maps have the same last key", + map.getLastKey(),getSampleKeys()[0]); + assertEquals("Both maps have the same last key", + map2.getLastKey(),getSampleKeys()[0]); + } + protected void tearDown() { labRat = null; }