Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects
In directory usw-pr-cvs1:/tmp/cvs-serv31012/src/core/com/mockobjects
Modified Files:
AbstractExpectationCollection.java ExpectationSet.java
ReturnObjectList.java
Log Message:
Added support for column types to MockResultSetMetaData and create a
common base class for both 1.3 and 1.4 jdk
Index: AbstractExpectationCollection.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/AbstractExpectationCollection.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractExpectationCollection.java 29 Jan 2002 14:56:01 -0000 1.3
+++ AbstractExpectationCollection.java 30 Aug 2002 14:49:57 -0000 1.4
@@ -1,9 +1,10 @@
package com.mockobjects;
-import java.util.*;
-import junit.framework.Assert;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
-abstract public class AbstractExpectationCollection extends AbstractExpectation implements ExpectationCollection {
+abstract public class AbstractExpectationCollection extends AbstractExpectation implements ExpectationCollection {
public AbstractExpectationCollection(String name) {
super(name);
@@ -16,6 +17,15 @@
}
}
+ public void addActual(int actualItem) {
+ Integer actualItemWrapper = new Integer(actualItem);
+
+ getActualCollection().add(actualItemWrapper);
+ if (shouldCheckImmediately()) {
+ checkImmediateValues(actualItemWrapper);
+ }
+ }
+
public void addActualMany(Object[] items) {
for (int i = 0; i < items.length; ++i) {
addActual(items[i]);
@@ -32,6 +42,12 @@
while (items.hasNext()) {
addActual(items.next());
}
+ }
+
+ public void addExpected(int expectedItem) {
+ Integer expectedItemWrapper = new Integer(expectedItem);
+ getExpectedCollection().add(expectedItemWrapper);
+ setHasExpectations();
}
public void addExpected(Object expectedItem) {
Index: ExpectationSet.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/ExpectationSet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ExpectationSet.java 29 Jul 2001 19:50:24 -0000 1.1
+++ ExpectationSet.java 30 Aug 2002 14:49:57 -0000 1.2
@@ -1,8 +1,9 @@
package com.mockobjects;
-import java.util.*;
-import junit.framework.Assert;
import com.mockobjects.util.AssertMo;
+
+import java.util.Collection;
+import java.util.HashSet;
public class ExpectationSet extends AbstractExpectationCollection {
private HashSet myExpectedItems = new HashSet();
Index: ReturnObjectList.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/ReturnObjectList.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ReturnObjectList.java 19 Jun 2002 15:11:00 -0000 1.3
+++ ReturnObjectList.java 30 Aug 2002 14:49:57 -0000 1.4
@@ -46,6 +46,14 @@
}
/**
+ * Add a next integer to the end of the list.
+ * @param anIntegerToReturn integer to be added to the list
+ */
+ public void addObjectToReturn(int anIntegerToReturn){
+ myObjects.add(new Integer(anIntegerToReturn));
+ }
+
+ /**
* Returns the next object from the list. Each object it returned in the
* order in which they where added.
*/
|