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 Wed, 13 Feb 2002 23:55:41 GMT
morgand     02/02/13 15:55:41

  Modified:    collections/src/test/org/apache/commons/collections
                        TestLRUMap.java
  Log:
  added test to make sure that putAll(Map) operation obeys the maximum
  Map size
  
  Revision  Changes    Path
  1.5       +28 -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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestLRUMap.java	13 Feb 2002 22:32:37 -0000	1.4
  +++ TestLRUMap.java	13 Feb 2002 23:55:41 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestLRUMap.java,v
1.4 2002/02/13 22:32:37 morgand Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/02/13 22:32:37 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestLRUMap.java,v
1.5 2002/02/13 23:55:41 morgand Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/02/13 23:55:41 $
    *
    * ====================================================================
    *
  @@ -68,8 +68,10 @@
   import java.util.HashMap;
   
   /**
  + * 
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  - * @version $Id: TestLRUMap.java,v 1.4 2002/02/13 22:32:37 morgand Exp $
  + * @author <a href="mailto:morgand@apache.org">Morgan Delagrange</a>
  + * @version $Id: TestLRUMap.java,v 1.5 2002/02/13 23:55:41 morgand Exp $
    */
   public class TestLRUMap extends TestHashMap
   {
  @@ -126,5 +128,27 @@
           
           assertTrue("size of Map should be 3, but was " + map2.size(), map2.size() == 3);
       }
  +
  +    /**
  +     * Confirm that putAll(Map) does not cause the LRUMap
  +     * to exceed its maxiumum size.
  +     */
  +    public void testPutAll() {
  +        LRUMap map2 = new LRUMap(3);
  +        map2.put(new Integer(1),"foo");
  +        map2.put(new Integer(2),"foo");
  +        map2.put(new Integer(3),"foo");
  +
  +        HashMap hashMap = new HashMap();
  +        hashMap.put(new Integer(4),"foo");
  +
  +        map2.putAll(hashMap);
  +
  +        assertTrue("max size is 3, but actual size is " + map2.size(),
  +                   map2.size() == 3);
  +        assertTrue("map should contain the Integer(4) object",
  +                   map2.containsKey(new Integer(4)));
  +    }
  +
   
   }
  
  
  

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