commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morg...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestSequencedHashMap.java
Date Fri, 22 Feb 2002 06:25:10 GMT
morgand     02/02/21 22:25:10

  Modified:    collections/src/test/org/apache/commons/collections
                        TestSequencedHashMap.java
  Log:
  more specific in-memory serialization tests for SequencedHashMap
  
  Revision  Changes    Path
  1.8       +24 -0     jakarta-commons/collections/src/test/org/apache/commons/collections/TestSequencedHashMap.java
  
  Index: TestSequencedHashMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestSequencedHashMap.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestSequencedHashMap.java	22 Feb 2002 02:18:50 -0000	1.7
  +++ TestSequencedHashMap.java	22 Feb 2002 06:25:10 -0000	1.8
  @@ -54,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.io.IOException;
  +import java.io.Serializable;
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
  @@ -175,6 +177,28 @@
           assertTrue("first key is correct",labRat.get(0).equals(new Integer(1)));
           labRat.put(new Integer(1),null);
           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() {
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message