Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv27819/core/com/mockobjects/dynamic
Modified Files:
Tag: DynamicMockExperiment
CallSequence.java
Log Message:
Missing test for call sequence index checking.
Index: CallSequence.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CallSequence.java,v
retrieving revision 1.4.2.3
retrieving revision 1.4.2.4
diff -u -r1.4.2.3 -r1.4.2.4
--- CallSequence.java 16 Apr 2003 16:31:44 -0000 1.4.2.3
+++ CallSequence.java 16 Apr 2003 17:20:29 -0000 1.4.2.4
@@ -41,7 +41,8 @@
}
public Object call(Mock mock, String methodName, Object[] args) throws Throwable {
- if (expectedCalls.size() == 0) throw new AssertionFailedError("no methods");
+ if (expectedCalls.size() == 0) throw new AssertionFailedError("no methods defined on mock, received: " + DynamicUtil.methodToString(methodName, args));
+ if (callIndex == expectedCalls.size()) throw new AssertionFailedError("mock called too many times, recieved: " + DynamicUtil.methodToString(methodName, args));
Callable nextCall = (Callable)expectedCalls.get(callIndex++);
if (nextCall.matches(methodName, args))
|