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 Thu, 21 Feb 2002 20:08:15 GMT
morgand     02/02/21 12:08:15

  Modified:    collections/src/test/org/apache/commons/collections
                        TestMap.java
  Log:
  unit test to reproduce a SequencedHashMap 1.3 bug
  
  Revision  Changes    Path
  1.6       +29 -5     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestMap.java	21 Feb 2002 19:57:33 -0000	1.5
  +++ TestMap.java	21 Feb 2002 20:08:15 -0000	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v
1.5 2002/02/21 19:57:33 morgand Exp $
  - * $Revision: 1.5 $
  - * $Date: 2002/02/21 19:57:33 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v
1.6 2002/02/21 20:08:15 morgand Exp $
  + * $Revision: 1.6 $
  + * $Date: 2002/02/21 20:08:15 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * test case (method) your {@link Map} fails.
    *
    * @author Rodney Waldhoff
  - * @version $Id: TestMap.java,v 1.5 2002/02/21 19:57:33 morgand Exp $
  + * @version $Id: TestMap.java,v 1.6 2002/02/21 20:08:15 morgand Exp $
    */
   public abstract class TestMap extends TestObject {
       public TestMap(String testName) {
  @@ -206,7 +206,8 @@
   
       public void testEntrySetRemove() {
   
  -        if ((this instanceof TestMap.EntrySetSupportsRemove) == false) {
  +        if ((this instanceof TestMap.EntrySetSupportsRemove) == false ||
  +            (this instanceof TestMap.SupportsPut) == false) {
               return;
           }
   
  @@ -225,6 +226,29 @@
           set.remove(o);
   
           assertTrue("size of Map should be 2, but was " + map.size(), map.size() == 2);
  +
  +    }
  +
  +    public void testEntrySetContains() {
  +
  +        if ((this instanceof TestMap.SupportsPut) == false) {
  +            return;
  +        }
  +
  +        Map map = makeMap();
  +        map.put("1","1");
  +        map.put("2","2");
  +        map.put("3","3");
  +
  +        Set set = map.entrySet();
  +        Object o = set.iterator().next();
  +        assertTrue("entry set should contain valid element",set.contains(o));
  +
  +        // make a bogus entry
  +        DefaultMapEntry entry = new DefaultMapEntry("4","4");
  +        assertTrue("entry set should not contain a bogus element",
  +                   set.contains(entry) == false);
  +        
   
       }
   
  
  
  

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