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 TestLRUMap.java
Date Thu, 14 Feb 2002 22:42:45 GMT
morgand     02/02/14 14:42:45

  Modified:    collections/src/test/org/apache/commons/collections
                        TestLRUMap.java
  Log:
  added unit test to insure backward compatibility of externalized
  LRUMaps
  
  Revision  Changes    Path
  1.7       +29 -4     jakarta-commons/collections/src/test/org/apache/commons/collections/TestLRUMap.java
  
  Index: TestLRUMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestLRUMap.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestLRUMap.java	14 Feb 2002 20:57:59 -0000	1.6
  +++ TestLRUMap.java	14 Feb 2002 22:42:45 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestLRUMap.java,v
1.6 2002/02/14 20:57:59 morgand Exp $
  - * $Revision: 1.6 $
  - * $Date: 2002/02/14 20:57:59 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestLRUMap.java,v
1.7 2002/02/14 22:42:45 morgand Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/02/14 22:42:45 $
    *
    * ====================================================================
    *
  @@ -64,6 +64,11 @@
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  +import java.io.FileInputStream;
  +import java.io.FileOutputStream;
  +import java.io.IOException;
  +import java.io.ObjectInputStream;
  +import java.io.ObjectOutputStream;
   import java.util.Map;
   import java.util.HashMap;
   
  @@ -71,7 +76,7 @@
    * 
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @author <a href="mailto:morgand@apache.org">Morgan Delagrange</a>
  - * @version $Id: TestLRUMap.java,v 1.6 2002/02/14 20:57:59 morgand Exp $
  + * @version $Id: TestLRUMap.java,v 1.7 2002/02/14 22:42:45 morgand Exp $
    */
   public class TestLRUMap extends TestHashMap
   {
  @@ -148,6 +153,26 @@
                      map2.size() == 3);
           assertTrue("map should contain the Integer(4) object",
                      map2.containsKey(new Integer(4)));
  +    }
  +
  +    public void testExternalizable() throws IOException, ClassNotFoundException {
  +        /*
  +         * Test object created with this code
  +         * Object created from CVS version 1.3 of this class
  +         *
  +        LRUMap map2 = new LRUMap(3);
  +        map2.put(new Integer(1),"foo");
  +        map2.put(new Integer(4),"bar");
  +        map2.put(new Integer(6),"yeah");
  +        map2.writeExternal(new ObjectOutputStream(new FileOutputStream("data/test/LRUMapVersion1.obj")));
  +         */
  +
  +        // purposely start me out with a smaller capacity
  +        LRUMap map2 = new LRUMap(1);
  +        map2.readExternal(new ObjectInputStream(new FileInputStream("data/test/LRUMapVersion1.obj")));
  +        assertTrue("Integer(1) equals foo",map2.get(new Integer(1)).equals("foo"));
  +        assertTrue("Integer(4) equals bar",map2.get(new Integer(4)).equals("bar"));
  +        assertTrue("Integer(6) equals yeah",map2.get(new Integer(6)).equals("yeah"));
       }
   
       /**
  
  
  

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