commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections AbstractTestCollection.java
Date Fri, 31 Oct 2003 01:23:11 GMT
scolebourne    2003/10/30 17:23:11

  Modified:    collections/src/test/org/apache/commons/collections
                        AbstractTestCollection.java
  Log:
  Improve error messages in verify
  Fix bug when TreeMap EntrySet used
  
  Revision  Changes    Path
  1.7       +13 -5     jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestCollection.java
  
  Index: AbstractTestCollection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestCollection.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractTestCollection.java	19 Oct 2003 00:25:11 -0000	1.6
  +++ AbstractTestCollection.java	31 Oct 2003 01:23:10 -0000	1.7
  @@ -69,6 +69,8 @@
   import java.util.Map;
   import java.util.NoSuchElementException;
   
  +import org.apache.commons.collections.pairs.DefaultMapEntry;
  +
   /**
    * Abstract test class for {@link java.util.Collection} methods and contracts.
    * <p>
  @@ -321,7 +323,8 @@
               // no match found!
               if(!match) {
                   fail("Collection should not contain a value that the " +
  -                     "confirmed collection does not have: " + o);
  +                     "confirmed collection does not have: " + o +
  +                     "\nTest: " + collection + "\nReal: " + confirmed);
               }
           }
           
  @@ -329,8 +332,8 @@
           for(int i = 0; i < confirmedSize; i++) {
               if(!matched[i]) {
                   // the collection didn't match all the confirmed values
  -                fail("Collection should contain all values that are in the " +
  -                     "confirmed collection");
  +                fail("Collection should contain all values that are in the confirmed collection"
+
  +                     "\nTest: " + collection + "\nReal: " + confirmed);
               }
           }
       }
  @@ -844,6 +847,11 @@
           Iterator iter = collection.iterator();
           while (iter.hasNext()) {
               Object o = iter.next();
  +            // TreeMap reuses the Map Entry, so the verify below fails
  +            // Clone it here if necessary
  +            if (o instanceof Map.Entry) {
  +                o = new DefaultMapEntry((Map.Entry) o);
  +            }
               iter.remove();
   
               // if the elements aren't distinguishable, we can just remove a
  
  
  

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


Mime
View raw message