From: Tim M. <ma...@us...> - 2003-05-20 00:05:27
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv10050/core/com/mockobjects/dynamic Modified Files: DefaultCallFactory.java Added Files: CallOnceExpectation.java Removed Files: ExpectedCall.java Log Message: Internal class rename - ExpectedCall to more specific CallOnceExpectation --- NEW FILE: CallOnceExpectation.java --- package com.mockobjects.dynamic; import junit.framework.*; public class CallOnceExpectation implements Callable { private Callable delegate; private boolean wasCalled = false; public CallOnceExpectation( Callable delegate ) { this.delegate = delegate; } public String getDescription() { return delegate.getDescription() + " [" + (wasCalled ? "" : "not ") + "called]"; } public Object call(Mock mock, String methodName, Object[] args) throws Throwable { wasCalled = true; return delegate.call( mock, methodName, args ); } public boolean matches(String methodName, Object[] args) { return (!wasCalled) && delegate.matches( methodName, args ); } public void verify() { if( !wasCalled ) { throw new AssertionFailedError( delegate.getDescription() + " was expected but not called" ); } delegate.verify(); } // Implemented to aid visualisation in an IDE debugger public String toString() { return Mock.className(this.getClass()) + "(" + this.getDescription() + ")"; } } Index: DefaultCallFactory.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/DefaultCallFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DefaultCallFactory.java 19 May 2003 23:56:23 -0000 1.4 +++ DefaultCallFactory.java 20 May 2003 00:05:24 -0000 1.5 @@ -11,7 +11,7 @@ } public Callable createCallExpectation(Callable call) { - return new ExpectedCall(call); + return new CallOnceExpectation(call); } public Callable createCallSignature(String methodName, ConstraintMatcher constraints, Callable call) { --- ExpectedCall.java DELETED --- |