Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv27982/src/core/com/mockobjects/dynamic
Modified Files:
CallSequence.java
Log Message:
Changed P to C
Tweaked list handling
Index: CallSequence.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CallSequence.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CallSequence.java 12 Nov 2002 17:42:37 -0000 1.2
+++ CallSequence.java 24 Nov 2002 11:02:38 -0000 1.3
@@ -20,7 +20,6 @@
implements MockCall, Verifiable
{
List _expected_calls = new ArrayList();
- int _next_index = 0;
public CallSequence() {
super();
@@ -59,7 +58,7 @@
* before being returned to the caller of the method.
*/
public void expectReturn( Object arg, Object result ) {
- expectReturn( P.args(P.eq(arg) ), result);
+ expectReturn( C.args(C.eq(arg) ), result);
}
/** Expect a method call with no parameters and return a result when it is called.
@@ -92,7 +91,7 @@
* An single object that will be compared with predicate eq()
*/
public void expectVoid( Object arg ) {
- expectVoid( P.args(P.eq(arg)) );
+ expectVoid( C.args(C.eq(arg)) );
}
/** Expect a call to a method with a void return type and no parameters
@@ -122,7 +121,7 @@
* The exception or error that will be thrown as a result of this call.
*/
public void expectThrow( Object arg, Throwable exception ) {
- expectThrow( P.args(P.eq(arg)), exception );
+ expectThrow( C.args(C.eq(arg)), exception );
}
/** Expect a method call with no parameters and throw an exception or error when it is called.
@@ -136,18 +135,13 @@
public Object call(Object[] args) throws Throwable {
- if( _next_index >= _expected_calls.size() ) {
- fail("too many calls");
- }
+ assertTrue("Too many calls", 0 != _expected_calls.size());
- MockCall call = (MockCall)_expected_calls.get(_next_index);
- _next_index++;
+ MockCall call = (MockCall)_expected_calls.remove(0);
return call.call( args );
}
public void verify() {
- if( _next_index < _expected_calls.size() ) {
- fail("too few calls");
- }
+ assertEquals("Too few calls", 0, _expected_calls.size());
}
}
|