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 TestMap.java
Date Fri, 22 Feb 2002 06:16:35 GMT
morgand     02/02/21 22:16:35

  Modified:    collections/src/test/org/apache/commons/collections
                        TestMap.java
  Log:
  in-memory serialization tests
  
  Revision  Changes    Path
  1.9       +30 -4     jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java
  
  Index: TestMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestMap.java	22 Feb 2002 02:18:50 -0000	1.8
  +++ TestMap.java	22 Feb 2002 06:16:35 -0000	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v
1.8 2002/02/22 02:18:50 mas Exp $
  - * $Revision: 1.8 $
  - * $Date: 2002/02/22 02:18:50 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v
1.9 2002/02/22 06:16:35 morgand Exp $
  + * $Revision: 1.9 $
  + * $Date: 2002/02/22 06:16:35 $
    *
    * ====================================================================
    *
  @@ -62,6 +62,8 @@
   package org.apache.commons.collections;
   
   import junit.framework.*;
  +import java.io.IOException;
  +import java.io.Serializable;
   import java.util.Collection;
   import java.util.Map;
   import java.util.Collection;
  @@ -85,7 +87,7 @@
    *
    * @author Michael Smith
    * @author Rodney Waldhoff
  - * @version $Id: TestMap.java,v 1.8 2002/02/22 02:18:50 mas Exp $
  + * @version $Id: TestMap.java,v 1.9 2002/02/22 06:16:35 morgand Exp $
    */
   public abstract class TestMap extends TestObject {
       public TestMap(String testName) {
  @@ -902,6 +904,30 @@
           
   
       }
  +
  +    public void testEmptyMapSerialization() 
  +    throws IOException, ClassNotFoundException {
  +        Map map = makeEmptyMap();
  +        if (!(map instanceof Serializable)) return;
  +        
  +        byte[] objekt = writeExternalFormToBytes((Serializable) map);
  +        Map map2 = (Map) readExternalFormFromBytes(objekt);
  +
  +        assertTrue("Both maps are empty",map.isEmpty()  == true);
  +        assertTrue("Both maps are empty",map2.isEmpty() == true);
  +    }
  +
  +    public void testFullMapSerialization() 
  +    throws IOException, ClassNotFoundException {
  +        Map map = makeFullMap();
  +        if (!(map instanceof Serializable)) return;
  +        
  +        byte[] objekt = writeExternalFormToBytes((Serializable) map);
  +        Map map2 = (Map) readExternalFormFromBytes(objekt);
  +
  +        assertEquals("Both maps are same size",map.size(), getSampleKeys().length);
  +        assertEquals("Both maps are same size",map2.size(),getSampleKeys().length);
  +    } 
   
       /*
           // optional operation
  
  
  

--
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