From: Jeff M. <cus...@us...> - 2003-05-14 14:59:37
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects In directory sc8-pr-cvs1:/tmp/cvs-serv16139/src/core/com/mockobjects Modified Files: AbstractExpectationCollection.java ExpectationMap.java ExpectationSet.java MapEntry.java Log Message: Fixed problem with hashes changing between setting up a set and verifying it Index: AbstractExpectationCollection.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/AbstractExpectationCollection.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- AbstractExpectationCollection.java 5 Nov 2002 16:02:36 -0000 1.5 +++ AbstractExpectationCollection.java 14 May 2003 14:59:34 -0000 1.6 @@ -3,6 +3,7 @@ import java.util.Collection; import java.util.Enumeration; import java.util.Iterator; +import java.util.HashSet; abstract public class AbstractExpectationCollection extends AbstractExpectation implements ExpectationCollection { @@ -91,7 +92,7 @@ public void verify() { assertEquals( "did not receive the expected collection items.", - getExpectedCollection(), - getActualCollection()); + new HashSet(getExpectedCollection()), + new HashSet(getActualCollection())); } } Index: ExpectationMap.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/ExpectationMap.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ExpectationMap.java 29 Jul 2001 19:50:24 -0000 1.1 +++ ExpectationMap.java 14 May 2003 14:59:34 -0000 1.2 @@ -5,10 +5,8 @@ public class ExpectationMap implements Expectation, Verifiable { private HashMap myEntries; private ExpectationSet myKeys; - private String myName; public ExpectationMap(String name) { - myName = name; myEntries = new HashMap(); myKeys = new ExpectationSet(name + " keys"); } Index: ExpectationSet.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/ExpectationSet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ExpectationSet.java 30 Aug 2002 14:49:57 -0000 1.2 +++ ExpectationSet.java 14 May 2003 14:59:34 -0000 1.3 @@ -16,7 +16,7 @@ protected void checkImmediateValues(Object actualItem) { AssertMo.assertTrue( myName + " did not receive an expected item\nUnexpected:" + actualItem, - myExpectedItems.contains(actualItem)); + new HashSet(myExpectedItems).contains(actualItem)); } protected Collection getActualCollection() { Index: MapEntry.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/MapEntry.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MapEntry.java 5 Sep 2002 08:39:22 -0000 1.2 +++ MapEntry.java 14 May 2003 14:59:34 -0000 1.3 @@ -15,7 +15,6 @@ private Object myValue; public MapEntry(Object aKey, Object aValue) { - super(); myKey = (aKey == null ? new Null() : aKey); myValue = (aValue == null ? new Null() : aValue); } |