From: Steve F. <sm...@us...> - 2003-06-12 22:45:23
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv21757/src/core/com/mockobjects/dynamic Modified Files: VoidStub.java CallSequence.java Mock.java CallOnceExpectation.java Callable.java ThrowStub.java CallBag.java CallSignature.java ReturnStub.java Log Message: Removed 'mock' parameter from Callable.call() Fixed up some of the field names in the mocks for testing dynamic mocks Index: VoidStub.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/VoidStub.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- VoidStub.java 18 May 2003 20:59:35 -0000 1.2 +++ VoidStub.java 12 Jun 2003 22:45:11 -0000 1.3 @@ -10,7 +10,7 @@ return "returns <void>"; } - public Object call(Mock mock, String methodName, Object[] args) throws Throwable { + public Object call(String methodName, Object[] args) throws Throwable { return null; } Index: CallSequence.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CallSequence.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- CallSequence.java 18 May 2003 20:59:35 -0000 1.5 +++ CallSequence.java 12 Jun 2003 22:45:12 -0000 1.6 @@ -17,16 +17,16 @@ this.matchedCalls.reset(); } - public Object call(Mock mock, String methodName, Object[] args) throws Throwable { + public Object call(String methodName, Object[] args) throws Throwable { 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, received: " + DynamicUtil.methodToString(methodName, args)); Callable nextCall = (Callable)expectedCalls.get(callIndex++); if (nextCall.matches(methodName, args)) - return nextCall.call(mock, methodName, args); + return nextCall.call(methodName, args); try { - return matchedCalls.call(mock, methodName, args); + return matchedCalls.call(methodName, args); } catch (AssertionFailedError ex) { throw createUnexpectedCallError(methodName, args); } Index: Mock.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/Mock.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Mock.java 8 Jun 2003 21:49:22 -0000 1.22 +++ Mock.java 12 Jun 2003 22:45:12 -0000 1.23 @@ -85,7 +85,7 @@ } else if (isMockNameGetter(method, args)) { return this.getMockName(); } else { - return calls.call(this, method.getName(), (args == null ? new Object[0] : args)); + return calls.call(method.getName(), (args == null ? new Object[0] : args)); } } catch (AssertionFailedError ex) { throw new AssertionFailedError(name + ": " + ex.getMessage()); Index: CallOnceExpectation.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CallOnceExpectation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CallOnceExpectation.java 20 May 2003 00:05:24 -0000 1.1 +++ CallOnceExpectation.java 12 Jun 2003 22:45:13 -0000 1.2 @@ -14,9 +14,9 @@ return delegate.getDescription() + " [" + (wasCalled ? "" : "not ") + "called]"; } - public Object call(Mock mock, String methodName, Object[] args) throws Throwable { + public Object call(String methodName, Object[] args) throws Throwable { wasCalled = true; - return delegate.call( mock, methodName, args ); + return delegate.call( methodName, args ); } public boolean matches(String methodName, Object[] args) { Index: Callable.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/Callable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Callable.java 18 May 2003 20:59:35 -0000 1.2 +++ Callable.java 12 Jun 2003 22:45:13 -0000 1.3 @@ -4,6 +4,6 @@ public interface Callable extends Verifiable { String getDescription(); - Object call( Mock mock, String methodName, Object[] args ) throws Throwable; + Object call( String methodName, Object[] args ) throws Throwable; boolean matches(String methodName, Object[] args); } Index: ThrowStub.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/ThrowStub.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ThrowStub.java 18 May 2003 20:59:35 -0000 1.2 +++ ThrowStub.java 12 Jun 2003 22:45:13 -0000 1.3 @@ -15,7 +15,7 @@ this.throwable = throwable; } - public Object call(Mock mock, String methodName, Object[] args) throws Throwable { + public Object call(String methodName, Object[] args) throws Throwable { throw throwable; } Index: CallBag.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CallBag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CallBag.java 8 Jun 2003 21:47:53 -0000 1.3 +++ CallBag.java 12 Jun 2003 22:45:14 -0000 1.4 @@ -20,7 +20,7 @@ this.expectedMatches.clear(); } - public Object call(Mock mock, String methodName, Object[] args) + public Object call(String methodName, Object[] args) throws Throwable { Callable matchingCall = findMatchingCall(methodName, args, this.expectedCalls); @@ -31,7 +31,7 @@ throw createUnexpectedCallError(methodName, args); } - return matchingCall.call(mock, methodName, args); + return matchingCall.call(methodName, args); } private Callable findMatchingCall(String methodName, Object[] args, List callList) { Index: CallSignature.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CallSignature.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CallSignature.java 19 May 2003 23:37:49 -0000 1.1 +++ CallSignature.java 12 Jun 2003 22:45:14 -0000 1.2 @@ -14,10 +14,10 @@ this.delegate = delegate; } - public Object call( Mock mock, String methodName, Object[] args ) + public Object call( String methodName, Object[] args ) throws Throwable { - return delegate.call( mock, methodName, args ); + return delegate.call( methodName, args ); } public void verify() { Index: ReturnStub.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/ReturnStub.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ReturnStub.java 18 May 2003 20:59:35 -0000 1.2 +++ ReturnStub.java 12 Jun 2003 22:45:14 -0000 1.3 @@ -15,7 +15,7 @@ this.result = result; } - public Object call(Mock mock, String methodName, Object[] args) throws Throwable { + public Object call(String methodName, Object[] args) throws Throwable { return result; } |