Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 74542 invoked from network); 31 Oct 2003 01:23:15 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 31 Oct 2003 01:23:15 -0000 Received: (qmail 61949 invoked by uid 500); 31 Oct 2003 01:22:56 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 61789 invoked by uid 500); 31 Oct 2003 01:22:55 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 61771 invoked by uid 500); 31 Oct 2003 01:22:55 -0000 Received: (qmail 61767 invoked from network); 31 Oct 2003 01:22:55 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 31 Oct 2003 01:22:55 -0000 Received: (qmail 74498 invoked by uid 1529); 31 Oct 2003 01:23:11 -0000 Date: 31 Oct 2003 01:23:11 -0000 Message-ID: <20031031012311.74497.qmail@minotaur.apache.org> From: scolebourne@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections AbstractTestCollection.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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. *

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