You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(13) |
Aug
(151) |
Sep
(21) |
Oct
(6) |
Nov
(70) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(47) |
Feb
(66) |
Mar
(23) |
Apr
(115) |
May
(24) |
Jun
(53) |
Jul
(10) |
Aug
(279) |
Sep
(84) |
Oct
(149) |
Nov
(138) |
Dec
(52) |
2003 |
Jan
(22) |
Feb
(20) |
Mar
(29) |
Apr
(106) |
May
(170) |
Jun
(122) |
Jul
(70) |
Aug
(64) |
Sep
(27) |
Oct
(71) |
Nov
(49) |
Dec
(9) |
2004 |
Jan
(7) |
Feb
(38) |
Mar
(3) |
Apr
(9) |
May
(22) |
Jun
(4) |
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(15) |
Dec
(2) |
2005 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(28) |
Jun
(3) |
Jul
(11) |
Aug
(5) |
Sep
(1) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2006 |
Jan
(8) |
Feb
(3) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv11585/src/core/com/mockobjects/dynamic Modified Files: Tag: Nat_reworks_dynamics_from_0_09 C.java Callable.java ThrowStub.java CallCollection.java ReturnStub.java VoidStub.java DefaultCallFactory.java CallOnceExpectation.java CallSequence.java Mock.java DynamicUtil.java CallFactory.java OrderedMock.java Added Files: Tag: Nat_reworks_dynamics_from_0_09 BaseCallCollectionBuilder.java CallSelection.java NameMatcher.java CompositeCallable.java Stub.java CallDecorator.java ArgumentMatcher.java ActiveCall.java CallCollectionBuilder.java Removed Files: Tag: Nat_reworks_dynamics_from_0_09 CallBag.java AnyConstraintMatcher.java ConstraintMatcher.java CallableAddable.java CallStub.java FullConstraintMatcher.java CallSignature.java Log Message: Branched and added Nat's latest reworking of the dynamic libraries --- NEW FILE: BaseCallCollectionBuilder.java --- package com.mockobjects.dynamic; import com.mockobjects.Verifiable; import com.mockobjects.constraint.Constraint; /** The BaseCallCollectionBuilder class acts as a template for the * {@link CallCollectionBuilder class}. All parameters of type * Object of methods in this class are overloaded for primitive types * in the CallCollectionBuilder class. */ public abstract class BaseCallCollectionBuilder implements CompositeCallable, Verifiable { private CallFactory callFactory; private CompositeCallable composite; public BaseCallCollectionBuilder( CallFactory callFactory, CompositeCallable composite ) { this.callFactory = callFactory; this.composite = composite; } public BaseCallCollectionBuilder( CompositeCallable composite ) { this( new DefaultCallFactory(), composite ); } public void addCallable( Callable callable ) { composite.addCallable( callable ); } public String getDescription() { return composite.getDescription(); } public Object call( ActiveCall call ) throws Throwable { return composite.call( call ); } public boolean matches( ActiveCall call ) { return composite.matches( call ); } public void reset() { this.composite.reset(); } public void verify() { composite.verify(); } public void expect( String methodName, Constraint[] args, Callable stub ) { addCallable( callFactory.createCallOnceExpectation( callFactory.createArgumentMatcher( methodName, args, stub ))); } public void expectVoid( String methodName, Constraint[] args ) { expect( methodName, args, callFactory.createVoidStub() ); } public void expectVoid( String methodName ) { expectVoid( methodName, C.NO_ARGS ); } public void expectVoid(String methodName, Object singleEqualArg ) { expectVoid( methodName, C.args(C.eq(singleEqualArg)) ); } public void expectVoid(String methodName, Constraint singleConstraint ) { expectVoid( methodName, new Constraint[]{ singleConstraint } ); } public void expectAndReturn( String methodName, Constraint[] args, Object result) { expect( methodName, args, callFactory.createReturnStub(result) ); } public void expectAndReturn(String methodName, Object result ) { this.expectAndReturn(methodName, C.NO_ARGS, result); } public void expectAndReturn(String methodName, Object singleEqualArg, Object result) { this.expectAndReturn(methodName, C.args(C.eq(singleEqualArg)), result); } public void expectAndReturn(String methodName, Constraint singleConstraint, Object result) { this.expectAndReturn( methodName, new Constraint[]{singleConstraint}, result); } public void expectAndThrow(String methodName, Constraint[] args, Throwable exception) { expect( methodName, args, callFactory.createThrowStub(exception) ); } public void expectAndThrow( String methodName, Throwable exception ) { expectAndThrow(methodName, C.NO_ARGS, exception); } public void expectAndThrow( String methodName, Object singleEqualArg, Throwable exception ) { expectAndThrow( methodName, C.args(C.eq(singleEqualArg)), exception ); } public void expectAndThrow( String methodName, Constraint singleConstraint, Throwable exception ) { this.expectAndThrow( methodName, new Constraint[]{ singleConstraint }, exception ); } public void match( String methodName, Constraint[] args, Callable stub ) { composite.addCallable( callFactory.createArgumentMatcher( methodName, args, stub ) ); } public void matchAndReturn(String methodName, Constraint[] args, Object result) { match( methodName, args, callFactory.createReturnStub(result)); } public void matchAndReturn(String methodName, Object result) { matchAndReturn( methodName, C.NO_ARGS, result ); } public void matchAndReturn( String methodName, Constraint singleConstraint, Object result ) { matchAndReturn( methodName, new Constraint[]{singleConstraint}, result); } public void matchAndReturn(String methodName, Object singleEqualArg, Object result) { this.matchAndReturn(methodName, C.args(C.eq(singleEqualArg)), result); } public void matchAndThrow(String methodName, Constraint[] args, Throwable throwable) { match( methodName, args, callFactory.createThrowStub(throwable) ); } public void matchAndThrow(String methodName, Throwable throwable) { this.matchAndThrow(methodName, C.NO_ARGS, throwable); } public void matchAndThrow(String methodName, Object singleEqualArg, Throwable throwable) { this.matchAndThrow(methodName, C.args(C.eq(singleEqualArg)), throwable); } public CallCollectionBuilder newCallSelection() { return addCallCollection( callFactory.createCallSelection() ); } public CallCollectionBuilder newCallSequence() { return addCallCollection( callFactory.createCallSequence() ); } private CallCollectionBuilder addCallCollection( CompositeCallable collection ) { composite.addCallable(collection); return callFactory.createCallCollectionBuilder( collection ); } } --- NEW FILE: CallSelection.java --- /* * Created on 04-Apr-2003 */ package com.mockobjects.dynamic; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.ListIterator; public class CallSelection extends CallCollection { private List calls = new ArrayList(); public CallSelection() { } public void reset() { calls.clear(); } public Object call( ActiveCall call ) throws Throwable { Callable matchingCall = findMatchingCall( call ); if(matchingCall == null) { throw createUnexpectedCallError(call); } return matchingCall.call( call ); } private Callable findMatchingCall( ActiveCall call ) { ListIterator i = calls.listIterator( calls.size() ); while( i.hasPrevious() ) { Callable element = (Callable) i.previous(); if (element.matches(call)) { return element; } } return null; } public String getDescription() { if (calls.isEmpty()) { return "no methods"; } else { StringBuffer buf = new StringBuffer(); buf.append("one of:\n"); for (Iterator i = calls.iterator(); i.hasNext();) { buf.append(((Callable) i.next()).getDescription()); buf.append("\n"); } return buf.toString(); } } public boolean matches( ActiveCall call ) { for( Iterator i = calls.iterator(); i.hasNext(); ) { Callable element = (Callable)i.next(); if( element.matches( call ) ) { return true; } } return false; } public void verify() { for (Iterator call = calls.iterator(); call.hasNext();) { Callable element = (Callable) call.next(); element.verify(); } } public void addCallable(Callable call) { calls.add(call); } } --- NEW FILE: NameMatcher.java --- /** Created on Jun 11, 2003 by npryce * Copyright (c) B13media Ltd. */ package com.mockobjects.dynamic; public class NameMatcher extends CallDecorator { private String methodName; public NameMatcher( String methodName, Callable delegate ) { super(delegate); this.methodName = methodName; } public boolean matches( ActiveCall call ) { return methodName.equals( call.getName() ) && super.matches( call ); } public String getDescription() { return getMethodName(); } public String getMethodName() { return methodName; } } --- NEW FILE: CompositeCallable.java --- package com.mockobjects.dynamic; public interface CompositeCallable extends Callable { /** TODO: rename this to something more user-centered. E.g. addRule (?). * requested by Ben Hogan. */ void addCallable( Callable call ); /** * Resets all expected calls and expected matches. */ void reset(); } --- NEW FILE: Stub.java --- /* * Created on 07-Apr-2003 */ package com.mockobjects.dynamic; public abstract class Stub implements Callable { public boolean matches( ActiveCall call ) { return true; } public void verify() { } } --- NEW FILE: CallDecorator.java --- /** Created on Jun 11, 2003 by npryce * Copyright (c) B13media Ltd. */ package com.mockobjects.dynamic; /** The base class for {@link Callable} objects that decorate stubs or * other {@link Callables} with expectations. * The default implementation passes calls through to the decorated * {@link Callable}. */ public class CallDecorator implements Callable { private Callable delegate; public CallDecorator( Callable delegate ) { this.delegate = delegate; } public String getDescription() { return delegate.getDescription(); } public boolean matches( ActiveCall call ) { return delegate.matches( call ); } public Object call( ActiveCall call ) throws Throwable { return delegate.call( call ); } public void verify() { delegate.verify(); } // Implemented to aid visualisation in an IDE debugger public String toString() { return Mock.className(getClass()) + "(" + getDescription() + ")"; } } --- NEW FILE: ArgumentMatcher.java --- package com.mockobjects.dynamic; import java.util.List; import com.mockobjects.constraint.Constraint; public class ArgumentMatcher extends NameMatcher { private Constraint[] constraints; public ArgumentMatcher( String methodName, Constraint[] constraints, Callable delegate ) { super( methodName, delegate ); this.constraints = (Constraint[])constraints.clone(); } public boolean matches( ActiveCall call ) { return super.matches(call) && constraintsMatch( call.getParameterValues() ); } private boolean constraintsMatch( List args ) { if( args.size() != constraints.length ) return false; for( int i = 0; i < args.size(); i++) { if( !constraints[i].eval(args.get(i)) ) return false; } return true; } public String getDescription() { return DynamicUtil.methodToString( getMethodName(), constraints ); } } --- NEW FILE: ActiveCall.java --- package com.mockobjects.dynamic; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Arrays; import java.util.Collections; import java.util.List; /** An object that holds information about a call dispatched to * a Mock object for err... mocking. */ public class ActiveCall { private String name; private Class[] parameterTypes; private Class returnType; private Object[] parameterValues; public ActiveCall( String name, Class[] parameterTypes, Class returnType, Object[] parameterValues ) { this.name = name; this.parameterTypes = (Class[])parameterTypes.clone(); this.returnType = returnType; if( parameterValues == null ) { this.parameterValues = new Object[0]; } else { this.parameterValues = (Object[])parameterValues.clone(); } } public ActiveCall( Method method, Object[] parameterValues ) { this( method.getName(), method.getParameterTypes(), method.getReturnType(), parameterValues ); } public String getName() { return name; } public List getParameterTypes() { return Collections.unmodifiableList(Arrays.asList(parameterTypes)); } public List getParameterValues() { return Collections.unmodifiableList(Arrays.asList(parameterValues)); } public Class getReturnType() { return returnType; } public String toString() { return DynamicUtil.methodToString( name, parameterValues ); } public boolean equals( Object o ) { if( o instanceof ActiveCall ) { return this.equals((ActiveCall)o); } else { return false; } } public int hashCode() { return name.hashCode() ^ arrayHashCode(parameterTypes) ^ returnType.hashCode() ^ arrayHashCode(parameterValues); } private int arrayHashCode( Object[] array ) { int hashCode = 0; for( int i = 0; i < array.length; i++ ) { hashCode ^= array[i].hashCode(); } return hashCode; } public boolean equals( ActiveCall call ) { return call != null && name.equals(call.name) && Arrays.equals( parameterTypes, call.parameterTypes ) && returnType.equals( call.returnType ) && Arrays.equals( parameterValues, call.parameterValues ); } boolean isCheckingEqualityOnProxy() { return name.equals("equals") && parameterValues.length == 1 && Proxy.isProxyClass(parameterValues[0].getClass()); } boolean isMockNameGetter() { return name.equals("getMockName") && parameterValues.length == 0; } } --- NEW FILE: CallCollectionBuilder.java --- // WARNING: DO NOT EDIT // This file was automatically generated by the Boxer (floats like a butterfly, strings like a bee) // Generated on Thu Jun 19 14:37:31 BST 2003 package com.mockobjects.dynamic; public class CallCollectionBuilder extends com.mockobjects.dynamic.BaseCallCollectionBuilder { public CallCollectionBuilder(com.mockobjects.dynamic.CallFactory arg0, com.mockobjects.dynamic.CompositeCallable arg1) { super(arg0, arg1); } public CallCollectionBuilder(com.mockobjects.dynamic.CompositeCallable arg0) { super(arg0); } public void expectVoid(java.lang.String arg0, byte arg1) { super.expectVoid(arg0, new Byte(arg1)); } public void expectVoid(java.lang.String arg0, char arg1) { super.expectVoid(arg0, new Character(arg1)); } public void expectVoid(java.lang.String arg0, long arg1) { super.expectVoid(arg0, new Long(arg1)); } public void expectVoid(java.lang.String arg0, double arg1) { super.expectVoid(arg0, new Double(arg1)); } public void expectVoid(java.lang.String arg0, int arg1) { super.expectVoid(arg0, new Integer(arg1)); } public void expectVoid(java.lang.String arg0, float arg1) { super.expectVoid(arg0, new Float(arg1)); } public void expectVoid(java.lang.String arg0, boolean arg1) { super.expectVoid(arg0, new Boolean(arg1)); } public void expectVoid(java.lang.String arg0, short arg1) { super.expectVoid(arg0, new Short(arg1)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, byte arg2) { super.expectAndReturn(arg0, arg1, new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, char arg2) { super.expectAndReturn(arg0, arg1, new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, long arg2) { super.expectAndReturn(arg0, arg1, new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, double arg2) { super.expectAndReturn(arg0, arg1, new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, int arg2) { super.expectAndReturn(arg0, arg1, new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, float arg2) { super.expectAndReturn(arg0, arg1, new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, boolean arg2) { super.expectAndReturn(arg0, arg1, new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, short arg2) { super.expectAndReturn(arg0, arg1, new Short(arg2)); } public void expectAndReturn(java.lang.String arg0, byte arg1) { super.expectAndReturn(arg0, new Byte(arg1)); } public void expectAndReturn(java.lang.String arg0, char arg1) { super.expectAndReturn(arg0, new Character(arg1)); } public void expectAndReturn(java.lang.String arg0, long arg1) { super.expectAndReturn(arg0, new Long(arg1)); } public void expectAndReturn(java.lang.String arg0, double arg1) { super.expectAndReturn(arg0, new Double(arg1)); } public void expectAndReturn(java.lang.String arg0, int arg1) { super.expectAndReturn(arg0, new Integer(arg1)); } public void expectAndReturn(java.lang.String arg0, float arg1) { super.expectAndReturn(arg0, new Float(arg1)); } public void expectAndReturn(java.lang.String arg0, boolean arg1) { super.expectAndReturn(arg0, new Boolean(arg1)); } public void expectAndReturn(java.lang.String arg0, short arg1) { super.expectAndReturn(arg0, new Short(arg1)); } public void expectAndReturn(java.lang.String arg0, byte arg1, byte arg2) { super.expectAndReturn(arg0, new Byte(arg1), new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, byte arg1, char arg2) { super.expectAndReturn(arg0, new Byte(arg1), new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, byte arg1, long arg2) { super.expectAndReturn(arg0, new Byte(arg1), new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, byte arg1, double arg2) { super.expectAndReturn(arg0, new Byte(arg1), new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, byte arg1, int arg2) { super.expectAndReturn(arg0, new Byte(arg1), new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, byte arg1, float arg2) { super.expectAndReturn(arg0, new Byte(arg1), new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, byte arg1, boolean arg2) { super.expectAndReturn(arg0, new Byte(arg1), new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, byte arg1, short arg2) { super.expectAndReturn(arg0, new Byte(arg1), new Short(arg2)); } public void expectAndReturn(java.lang.String arg0, char arg1, byte arg2) { super.expectAndReturn(arg0, new Character(arg1), new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, char arg1, char arg2) { super.expectAndReturn(arg0, new Character(arg1), new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, char arg1, long arg2) { super.expectAndReturn(arg0, new Character(arg1), new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, char arg1, double arg2) { super.expectAndReturn(arg0, new Character(arg1), new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, char arg1, int arg2) { super.expectAndReturn(arg0, new Character(arg1), new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, char arg1, float arg2) { super.expectAndReturn(arg0, new Character(arg1), new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, char arg1, boolean arg2) { super.expectAndReturn(arg0, new Character(arg1), new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, char arg1, short arg2) { super.expectAndReturn(arg0, new Character(arg1), new Short(arg2)); } public void expectAndReturn(java.lang.String arg0, long arg1, byte arg2) { super.expectAndReturn(arg0, new Long(arg1), new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, long arg1, char arg2) { super.expectAndReturn(arg0, new Long(arg1), new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, long arg1, long arg2) { super.expectAndReturn(arg0, new Long(arg1), new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, long arg1, double arg2) { super.expectAndReturn(arg0, new Long(arg1), new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, long arg1, int arg2) { super.expectAndReturn(arg0, new Long(arg1), new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, long arg1, float arg2) { super.expectAndReturn(arg0, new Long(arg1), new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, long arg1, boolean arg2) { super.expectAndReturn(arg0, new Long(arg1), new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, long arg1, short arg2) { super.expectAndReturn(arg0, new Long(arg1), new Short(arg2)); } public void expectAndReturn(java.lang.String arg0, double arg1, byte arg2) { super.expectAndReturn(arg0, new Double(arg1), new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, double arg1, char arg2) { super.expectAndReturn(arg0, new Double(arg1), new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, double arg1, long arg2) { super.expectAndReturn(arg0, new Double(arg1), new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, double arg1, double arg2) { super.expectAndReturn(arg0, new Double(arg1), new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, double arg1, int arg2) { super.expectAndReturn(arg0, new Double(arg1), new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, double arg1, float arg2) { super.expectAndReturn(arg0, new Double(arg1), new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, double arg1, boolean arg2) { super.expectAndReturn(arg0, new Double(arg1), new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, double arg1, short arg2) { super.expectAndReturn(arg0, new Double(arg1), new Short(arg2)); } public void expectAndReturn(java.lang.String arg0, int arg1, byte arg2) { super.expectAndReturn(arg0, new Integer(arg1), new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, int arg1, char arg2) { super.expectAndReturn(arg0, new Integer(arg1), new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, int arg1, long arg2) { super.expectAndReturn(arg0, new Integer(arg1), new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, int arg1, double arg2) { super.expectAndReturn(arg0, new Integer(arg1), new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, int arg1, int arg2) { super.expectAndReturn(arg0, new Integer(arg1), new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, int arg1, float arg2) { super.expectAndReturn(arg0, new Integer(arg1), new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, int arg1, boolean arg2) { super.expectAndReturn(arg0, new Integer(arg1), new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, int arg1, short arg2) { super.expectAndReturn(arg0, new Integer(arg1), new Short(arg2)); } public void expectAndReturn(java.lang.String arg0, float arg1, byte arg2) { super.expectAndReturn(arg0, new Float(arg1), new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, float arg1, char arg2) { super.expectAndReturn(arg0, new Float(arg1), new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, float arg1, long arg2) { super.expectAndReturn(arg0, new Float(arg1), new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, float arg1, double arg2) { super.expectAndReturn(arg0, new Float(arg1), new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, float arg1, int arg2) { super.expectAndReturn(arg0, new Float(arg1), new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, float arg1, float arg2) { super.expectAndReturn(arg0, new Float(arg1), new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, float arg1, boolean arg2) { super.expectAndReturn(arg0, new Float(arg1), new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, float arg1, short arg2) { super.expectAndReturn(arg0, new Float(arg1), new Short(arg2)); } public void expectAndReturn(java.lang.String arg0, boolean arg1, byte arg2) { super.expectAndReturn(arg0, new Boolean(arg1), new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, boolean arg1, char arg2) { super.expectAndReturn(arg0, new Boolean(arg1), new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, boolean arg1, long arg2) { super.expectAndReturn(arg0, new Boolean(arg1), new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, boolean arg1, double arg2) { super.expectAndReturn(arg0, new Boolean(arg1), new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, boolean arg1, int arg2) { super.expectAndReturn(arg0, new Boolean(arg1), new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, boolean arg1, float arg2) { super.expectAndReturn(arg0, new Boolean(arg1), new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, boolean arg1, boolean arg2) { super.expectAndReturn(arg0, new Boolean(arg1), new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, boolean arg1, short arg2) { super.expectAndReturn(arg0, new Boolean(arg1), new Short(arg2)); } public void expectAndReturn(java.lang.String arg0, short arg1, byte arg2) { super.expectAndReturn(arg0, new Short(arg1), new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, short arg1, char arg2) { super.expectAndReturn(arg0, new Short(arg1), new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, short arg1, long arg2) { super.expectAndReturn(arg0, new Short(arg1), new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, short arg1, double arg2) { super.expectAndReturn(arg0, new Short(arg1), new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, short arg1, int arg2) { super.expectAndReturn(arg0, new Short(arg1), new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, short arg1, float arg2) { super.expectAndReturn(arg0, new Short(arg1), new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, short arg1, boolean arg2) { super.expectAndReturn(arg0, new Short(arg1), new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, short arg1, short arg2) { super.expectAndReturn(arg0, new Short(arg1), new Short(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, byte arg2) { super.expectAndReturn(arg0, arg1, new Byte(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, char arg2) { super.expectAndReturn(arg0, arg1, new Character(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, long arg2) { super.expectAndReturn(arg0, arg1, new Long(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, double arg2) { super.expectAndReturn(arg0, arg1, new Double(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, int arg2) { super.expectAndReturn(arg0, arg1, new Integer(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, float arg2) { super.expectAndReturn(arg0, arg1, new Float(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, boolean arg2) { super.expectAndReturn(arg0, arg1, new Boolean(arg2)); } public void expectAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, short arg2) { super.expectAndReturn(arg0, arg1, new Short(arg2)); } public void expectAndThrow(java.lang.String arg0, byte arg1, java.lang.Throwable arg2) { super.expectAndThrow(arg0, new Byte(arg1), arg2); } public void expectAndThrow(java.lang.String arg0, char arg1, java.lang.Throwable arg2) { super.expectAndThrow(arg0, new Character(arg1), arg2); } public void expectAndThrow(java.lang.String arg0, long arg1, java.lang.Throwable arg2) { super.expectAndThrow(arg0, new Long(arg1), arg2); } public void expectAndThrow(java.lang.String arg0, double arg1, java.lang.Throwable arg2) { super.expectAndThrow(arg0, new Double(arg1), arg2); } public void expectAndThrow(java.lang.String arg0, int arg1, java.lang.Throwable arg2) { super.expectAndThrow(arg0, new Integer(arg1), arg2); } public void expectAndThrow(java.lang.String arg0, float arg1, java.lang.Throwable arg2) { super.expectAndThrow(arg0, new Float(arg1), arg2); } public void expectAndThrow(java.lang.String arg0, boolean arg1, java.lang.Throwable arg2) { super.expectAndThrow(arg0, new Boolean(arg1), arg2); } public void expectAndThrow(java.lang.String arg0, short arg1, java.lang.Throwable arg2) { super.expectAndThrow(arg0, new Short(arg1), arg2); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, byte arg2) { super.matchAndReturn(arg0, arg1, new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, char arg2) { super.matchAndReturn(arg0, arg1, new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, long arg2) { super.matchAndReturn(arg0, arg1, new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, double arg2) { super.matchAndReturn(arg0, arg1, new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, int arg2) { super.matchAndReturn(arg0, arg1, new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, float arg2) { super.matchAndReturn(arg0, arg1, new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, boolean arg2) { super.matchAndReturn(arg0, arg1, new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint[] arg1, short arg2) { super.matchAndReturn(arg0, arg1, new Short(arg2)); } public void matchAndReturn(java.lang.String arg0, byte arg1) { super.matchAndReturn(arg0, new Byte(arg1)); } public void matchAndReturn(java.lang.String arg0, char arg1) { super.matchAndReturn(arg0, new Character(arg1)); } public void matchAndReturn(java.lang.String arg0, long arg1) { super.matchAndReturn(arg0, new Long(arg1)); } public void matchAndReturn(java.lang.String arg0, double arg1) { super.matchAndReturn(arg0, new Double(arg1)); } public void matchAndReturn(java.lang.String arg0, int arg1) { super.matchAndReturn(arg0, new Integer(arg1)); } public void matchAndReturn(java.lang.String arg0, float arg1) { super.matchAndReturn(arg0, new Float(arg1)); } public void matchAndReturn(java.lang.String arg0, boolean arg1) { super.matchAndReturn(arg0, new Boolean(arg1)); } public void matchAndReturn(java.lang.String arg0, short arg1) { super.matchAndReturn(arg0, new Short(arg1)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, byte arg2) { super.matchAndReturn(arg0, arg1, new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, char arg2) { super.matchAndReturn(arg0, arg1, new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, long arg2) { super.matchAndReturn(arg0, arg1, new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, double arg2) { super.matchAndReturn(arg0, arg1, new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, int arg2) { super.matchAndReturn(arg0, arg1, new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, float arg2) { super.matchAndReturn(arg0, arg1, new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, boolean arg2) { super.matchAndReturn(arg0, arg1, new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, com.mockobjects.constraint.Constraint arg1, short arg2) { super.matchAndReturn(arg0, arg1, new Short(arg2)); } public void matchAndReturn(java.lang.String arg0, byte arg1, byte arg2) { super.matchAndReturn(arg0, new Byte(arg1), new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, byte arg1, char arg2) { super.matchAndReturn(arg0, new Byte(arg1), new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, byte arg1, long arg2) { super.matchAndReturn(arg0, new Byte(arg1), new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, byte arg1, double arg2) { super.matchAndReturn(arg0, new Byte(arg1), new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, byte arg1, int arg2) { super.matchAndReturn(arg0, new Byte(arg1), new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, byte arg1, float arg2) { super.matchAndReturn(arg0, new Byte(arg1), new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, byte arg1, boolean arg2) { super.matchAndReturn(arg0, new Byte(arg1), new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, byte arg1, short arg2) { super.matchAndReturn(arg0, new Byte(arg1), new Short(arg2)); } public void matchAndReturn(java.lang.String arg0, char arg1, byte arg2) { super.matchAndReturn(arg0, new Character(arg1), new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, char arg1, char arg2) { super.matchAndReturn(arg0, new Character(arg1), new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, char arg1, long arg2) { super.matchAndReturn(arg0, new Character(arg1), new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, char arg1, double arg2) { super.matchAndReturn(arg0, new Character(arg1), new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, char arg1, int arg2) { super.matchAndReturn(arg0, new Character(arg1), new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, char arg1, float arg2) { super.matchAndReturn(arg0, new Character(arg1), new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, char arg1, boolean arg2) { super.matchAndReturn(arg0, new Character(arg1), new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, char arg1, short arg2) { super.matchAndReturn(arg0, new Character(arg1), new Short(arg2)); } public void matchAndReturn(java.lang.String arg0, long arg1, byte arg2) { super.matchAndReturn(arg0, new Long(arg1), new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, long arg1, char arg2) { super.matchAndReturn(arg0, new Long(arg1), new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, long arg1, long arg2) { super.matchAndReturn(arg0, new Long(arg1), new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, long arg1, double arg2) { super.matchAndReturn(arg0, new Long(arg1), new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, long arg1, int arg2) { super.matchAndReturn(arg0, new Long(arg1), new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, long arg1, float arg2) { super.matchAndReturn(arg0, new Long(arg1), new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, long arg1, boolean arg2) { super.matchAndReturn(arg0, new Long(arg1), new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, long arg1, short arg2) { super.matchAndReturn(arg0, new Long(arg1), new Short(arg2)); } public void matchAndReturn(java.lang.String arg0, double arg1, byte arg2) { super.matchAndReturn(arg0, new Double(arg1), new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, double arg1, char arg2) { super.matchAndReturn(arg0, new Double(arg1), new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, double arg1, long arg2) { super.matchAndReturn(arg0, new Double(arg1), new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, double arg1, double arg2) { super.matchAndReturn(arg0, new Double(arg1), new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, double arg1, int arg2) { super.matchAndReturn(arg0, new Double(arg1), new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, double arg1, float arg2) { super.matchAndReturn(arg0, new Double(arg1), new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, double arg1, boolean arg2) { super.matchAndReturn(arg0, new Double(arg1), new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, double arg1, short arg2) { super.matchAndReturn(arg0, new Double(arg1), new Short(arg2)); } public void matchAndReturn(java.lang.String arg0, int arg1, byte arg2) { super.matchAndReturn(arg0, new Integer(arg1), new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, int arg1, char arg2) { super.matchAndReturn(arg0, new Integer(arg1), new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, int arg1, long arg2) { super.matchAndReturn(arg0, new Integer(arg1), new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, int arg1, double arg2) { super.matchAndReturn(arg0, new Integer(arg1), new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, int arg1, int arg2) { super.matchAndReturn(arg0, new Integer(arg1), new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, int arg1, float arg2) { super.matchAndReturn(arg0, new Integer(arg1), new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, int arg1, boolean arg2) { super.matchAndReturn(arg0, new Integer(arg1), new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, int arg1, short arg2) { super.matchAndReturn(arg0, new Integer(arg1), new Short(arg2)); } public void matchAndReturn(java.lang.String arg0, float arg1, byte arg2) { super.matchAndReturn(arg0, new Float(arg1), new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, float arg1, char arg2) { super.matchAndReturn(arg0, new Float(arg1), new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, float arg1, long arg2) { super.matchAndReturn(arg0, new Float(arg1), new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, float arg1, double arg2) { super.matchAndReturn(arg0, new Float(arg1), new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, float arg1, int arg2) { super.matchAndReturn(arg0, new Float(arg1), new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, float arg1, float arg2) { super.matchAndReturn(arg0, new Float(arg1), new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, float arg1, boolean arg2) { super.matchAndReturn(arg0, new Float(arg1), new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, float arg1, short arg2) { super.matchAndReturn(arg0, new Float(arg1), new Short(arg2)); } public void matchAndReturn(java.lang.String arg0, boolean arg1, byte arg2) { super.matchAndReturn(arg0, new Boolean(arg1), new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, boolean arg1, char arg2) { super.matchAndReturn(arg0, new Boolean(arg1), new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, boolean arg1, long arg2) { super.matchAndReturn(arg0, new Boolean(arg1), new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, boolean arg1, double arg2) { super.matchAndReturn(arg0, new Boolean(arg1), new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, boolean arg1, int arg2) { super.matchAndReturn(arg0, new Boolean(arg1), new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, boolean arg1, float arg2) { super.matchAndReturn(arg0, new Boolean(arg1), new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, boolean arg1, boolean arg2) { super.matchAndReturn(arg0, new Boolean(arg1), new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, boolean arg1, short arg2) { super.matchAndReturn(arg0, new Boolean(arg1), new Short(arg2)); } public void matchAndReturn(java.lang.String arg0, short arg1, byte arg2) { super.matchAndReturn(arg0, new Short(arg1), new Byte(arg2)); } public void matchAndReturn(java.lang.String arg0, short arg1, char arg2) { super.matchAndReturn(arg0, new Short(arg1), new Character(arg2)); } public void matchAndReturn(java.lang.String arg0, short arg1, long arg2) { super.matchAndReturn(arg0, new Short(arg1), new Long(arg2)); } public void matchAndReturn(java.lang.String arg0, short arg1, double arg2) { super.matchAndReturn(arg0, new Short(arg1), new Double(arg2)); } public void matchAndReturn(java.lang.String arg0, short arg1, int arg2) { super.matchAndReturn(arg0, new Short(arg1), new Integer(arg2)); } public void matchAndReturn(java.lang.String arg0, short arg1, float arg2) { super.matchAndReturn(arg0, new Short(arg1), new Float(arg2)); } public void matchAndReturn(java.lang.String arg0, short arg1, boolean arg2) { super.matchAndReturn(arg0, new Short(arg1), new Boolean(arg2)); } public void matchAndReturn(java.lang.String arg0, short arg1, short arg2) { super.matchAndReturn(arg0, new Short(arg1), new Short(arg2)); } public void matchAndThrow(java.lang.String arg0, byte arg1, java.lang.Throwable arg2) { super.matchAndThrow(arg0, new Byte(arg1), arg2); } public void matchAndThrow(java.lang.String arg0, char arg1, java.lang.Throwable arg2) { super.matchAndThrow(arg0, new Character(arg1), arg2); } public void matchAndThrow(java.lang.String arg0, long arg1, java.lang.Throwable arg2) { super.matchAndThrow(arg0, new Long(arg1), arg2); } public void matchAndThrow(java.lang.String arg0, double arg1, java.lang.Throwable arg2) { super.matchAndThrow(arg0, new Double(arg1), arg2); } public void matchAndThrow(java.lang.String arg0, int arg1, java.lang.Throwable arg2) { super.matchAndThrow(arg0, new Integer(arg1), arg2); } public void matchAndThrow(java.lang.String arg0, float arg1, java.lang.Throwable arg2) { super.matchAndThrow(arg0, new Float(arg1), arg2); } public void matchAndThrow(java.lang.String arg0, boolean arg1, java.lang.Throwable arg2) { super.matchAndThrow(arg0, new Boolean(arg1), arg2); } public void matchAndThrow(java.lang.String arg0, short arg1, java.lang.Throwable arg2) { super.matchAndThrow(arg0, new Short(arg1), arg2); } } Index: C.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/C.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- C.java 1 Jun 2003 11:40:45 -0000 1.3 +++ C.java 21 Jun 2003 14:01:07 -0000 1.3.2.1 @@ -19,8 +19,7 @@ public static final Constraint IS_ZERO = eq(new Integer(0)); public static final Constraint IS_NOT_ZERO = not(IS_ZERO); - public static final ConstraintMatcher NO_ARGS = new FullConstraintMatcher(new Constraint[0]); - public static final ConstraintMatcher ANY_ARGS = new AnyConstraintMatcher(); + public static final Constraint[] NO_ARGS = new Constraint[0]; public static Constraint same( Object o ) { return new IsSame(o); @@ -30,17 +29,17 @@ return new IsEqual(o); } - public static ConstraintMatcher eq( Object arg0, Object arg1 ) { + public static Constraint[] eq( Object arg0, Object arg1 ) { return args(eq(arg0), eq(arg1)); } - public static ConstraintMatcher eq( Object arg0, Object arg1, Object arg2 ) { + public static Constraint[] eq( Object arg0, Object arg1, Object arg2 ) { return args(eq(arg0), eq(arg1), eq(arg2)); } - public static ConstraintMatcher eq( Object arg0, Object arg1, Object arg2, Object arg3 ) { - return args(eq(arg0), eq(arg1), eq(arg2), eq(arg3)); - } + public static Constraint[] eq( Object arg0, Object arg1, Object arg2, Object arg3 ) { + return args(eq(arg0), eq(arg1), eq(arg2), eq(arg3)); + } public static Constraint eq( int n ) { return new IsEqual( new Integer(n) ); @@ -107,32 +106,39 @@ /* Helper methods for succinctly constructing Constraint arrays */ - public static ConstraintMatcher args() { + public static Constraint[] args() { return NO_ARGS; } - - public static ConstraintMatcher args(Constraint p) { - return new FullConstraintMatcher(new Constraint[]{p}); + + public static Constraint[] args(Constraint p) { + return new Constraint[]{ p }; } - - public static ConstraintMatcher args(Constraint p1, Constraint p2) { - return new FullConstraintMatcher(new Constraint[]{p1, p2}); + + public static Constraint[] args(Constraint p1, Constraint p2) { + return new Constraint[]{ p1, p2 }; } - public static ConstraintMatcher args(Constraint p1, Constraint p2, Constraint p3) { - return new FullConstraintMatcher(new Constraint[]{p1, p2, p3}); + public static Constraint[] args( Constraint p1, + Constraint p2, + Constraint p3 ) + { + return new Constraint[]{p1, p2, p3}; + } + + public static Constraint[] args( Constraint p1, + Constraint p2, + Constraint p3, + Constraint p4 ) + { + return new Constraint[]{p1, p2, p3, p4}; } - - public static ConstraintMatcher args(Constraint p1, Constraint p2, Constraint p3, Constraint p4) { - return new FullConstraintMatcher(new Constraint[]{p1, p2, p3, p4}); - } - public static ConstraintMatcher anyArgs( int argCount) { + public static Constraint[] anyArgs( int argCount ) { Constraint[] constraints = new Constraint[argCount]; for (int i = 0; i < constraints.length; i++) { constraints[i] = new IsAnything(); } - return new FullConstraintMatcher(constraints); + return constraints; } } Index: Callable.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/Callable.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- Callable.java 12 Jun 2003 22:45:13 -0000 1.3 +++ Callable.java 21 Jun 2003 14:01:07 -0000 1.3.2.1 @@ -1,9 +1,12 @@ package com.mockobjects.dynamic; -import com.mockobjects.*; +import com.mockobjects.Verifiable; -public interface Callable extends Verifiable { +public interface Callable extends Verifiable +{ String getDescription(); - Object call( String methodName, Object[] args ) throws Throwable; - boolean matches(String methodName, Object[] args); + + boolean matches( ActiveCall call ); + + Object call( ActiveCall call ) throws Throwable; } Index: ThrowStub.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/ThrowStub.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- ThrowStub.java 12 Jun 2003 22:45:13 -0000 1.3 +++ ThrowStub.java 21 Jun 2003 14:01:07 -0000 1.3.2.1 @@ -7,7 +7,7 @@ * @author dev */ public class ThrowStub - extends CallStub + extends Stub { private Throwable throwable; @@ -15,7 +15,7 @@ this.throwable = throwable; } - public Object call(String methodName, Object[] args) throws Throwable { + public Object call( ActiveCall call ) throws Throwable { throw throwable; } Index: CallCollection.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CallCollection.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- CallCollection.java 8 Jun 2003 21:48:24 -0000 1.3 +++ CallCollection.java 21 Jun 2003 14:01:07 -0000 1.3.2.1 @@ -2,18 +2,20 @@ import junit.framework.AssertionFailedError; -abstract public class CallCollection { - protected AssertionFailedError createUnexpectedCallError(String methodName, Object[] args) { - +abstract public class CallCollection + implements CompositeCallable +{ + protected + AssertionFailedError createUnexpectedCallError( ActiveCall call ) { StringBuffer buf = new StringBuffer(); buf.append("Unexpected call: "); - buf.append(DynamicUtil.methodToString(methodName, args)); + buf.append( DynamicUtil.methodToString( + call.getName(), call.getParameterValues().toArray()) ); buf.append("\n"); buf.append("Expected "); buf.append(getDescription()); + return new AssertionFailedError(buf.toString()); } - - abstract protected String getDescription(); } Index: ReturnStub.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/ReturnStub.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- ReturnStub.java 12 Jun 2003 22:45:14 -0000 1.3 +++ ReturnStub.java 21 Jun 2003 14:01:07 -0000 1.3.2.1 @@ -7,7 +7,7 @@ * @author dev */ public class ReturnStub - extends CallStub + extends Stub { private Object result; @@ -15,7 +15,7 @@ this.result = result; } - public Object call(String methodName, Object[] args) throws Throwable { + public Object call( ActiveCall call ) throws Throwable { return result; } Index: VoidStub.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/VoidStub.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- VoidStub.java 12 Jun 2003 22:45:11 -0000 1.3 +++ VoidStub.java 21 Jun 2003 14:01:07 -0000 1.3.2.1 @@ -4,13 +4,13 @@ package com.mockobjects.dynamic; -public class VoidStub extends CallStub { +public class VoidStub extends Stub { public String getDescription() { return "returns <void>"; } - public Object call(String methodName, Object[] args) throws Throwable { + public Object call( ActiveCall call ) throws Throwable { return null; } Index: DefaultCallFactory.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/DefaultCallFactory.java,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -r1.5 -r1.5.2.1 --- DefaultCallFactory.java 20 May 2003 00:05:24 -0000 1.5 +++ DefaultCallFactory.java 21 Jun 2003 14:01:07 -0000 1.5.2.1 @@ -1,5 +1,7 @@ package com.mockobjects.dynamic; +import com.mockobjects.constraint.Constraint; + public class DefaultCallFactory implements CallFactory { public Callable createReturnStub(Object result) { @@ -10,16 +12,30 @@ return new ThrowStub(exception); } - public Callable createCallExpectation(Callable call) { + public Callable createCallOnceExpectation(Callable call) { return new CallOnceExpectation(call); } - public Callable createCallSignature(String methodName, ConstraintMatcher constraints, Callable call) { - return new CallSignature( methodName, constraints, call ); + public Callable createArgumentMatcher( String methodName, + Constraint[] constraints, + Callable call ) + { + return new ArgumentMatcher( methodName, constraints, call ); } public Callable createVoidStub() { return new VoidStub(); } + public CompositeCallable createCallSelection() { + return new CallSelection(); + } + + public CompositeCallable createCallSequence() { + return new CallSequence(); + } + + public CallCollectionBuilder createCallCollectionBuilder(CompositeCallable collection) { + return new CallCollectionBuilder( this, collection ); + } } Index: CallOnceExpectation.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CallOnceExpectation.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- CallOnceExpectation.java 12 Jun 2003 22:45:13 -0000 1.2 +++ CallOnceExpectation.java 21 Jun 2003 14:01:07 -0000 1.2.2.1 @@ -1,38 +1,35 @@ package com.mockobjects.dynamic; -import junit.framework.*; +import junit.framework.AssertionFailedError; -public class CallOnceExpectation implements Callable { - private Callable delegate; +public class CallOnceExpectation + extends CallDecorator +{ private boolean wasCalled = false; public CallOnceExpectation( Callable delegate ) { - this.delegate = delegate; + super(delegate); } public String getDescription() { - return delegate.getDescription() + " [" + (wasCalled ? "" : "not ") + "called]"; + return super.getDescription() + " [" + (wasCalled ? "" : "not ") + "called]"; } - public Object call(String methodName, Object[] args) throws Throwable { + public Object call( ActiveCall call ) throws Throwable { wasCalled = true; - return delegate.call( methodName, args ); + return super.call( call ); } - public boolean matches(String methodName, Object[] args) { - return (!wasCalled) && delegate.matches( methodName, args ); + public boolean matches( ActiveCall call ) { + return (!wasCalled) && super.matches( call ); } public void verify() { if( !wasCalled ) { - throw new AssertionFailedError( delegate.getDescription() + " was expected but not called" ); + throw new AssertionFailedError( + super.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() + ")"; + super.verify(); } } Index: CallSequence.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CallSequence.java,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -r1.6 -r1.6.2.1 --- CallSequence.java 12 Jun 2003 22:45:12 -0000 1.6 +++ CallSequence.java 21 Jun 2003 14:01:07 -0000 1.6.2.1 @@ -5,33 +5,37 @@ import junit.framework.AssertionFailedError; -public class CallSequence extends CallCollection implements Callable, CallableAddable { - +public class CallSequence extends CallCollection +{ private ArrayList expectedCalls = new ArrayList(); - private CallBag matchedCalls = new CallBag(); int callIndex = 0; - public void reset() - { - this.expectedCalls.clear(); - this.matchedCalls.reset(); + public void reset() { + expectedCalls.clear(); + callIndex = 0; } - 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)); + public Object call( ActiveCall call ) throws Throwable { + if (expectedCalls.size() == 0) { + throw new AssertionFailedError( + "no methods defined on mock, received: " + call ); + } + if (callIndex == expectedCalls.size()) { + throw new AssertionFailedError( + "mock called too many times, received: " + call ); + } - Callable nextCall = (Callable)expectedCalls.get(callIndex++); - if (nextCall.matches(methodName, args)) - return nextCall.call(methodName, args); - - try { - return matchedCalls.call(methodName, args);... [truncated message content] |
From: Steve F. <sm...@us...> - 2003-06-21 14:01:11
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/constraint In directory sc8-pr-cvs1:/tmp/cvs-serv11585/src/core/test/mockobjects/constraint Modified Files: Tag: Nat_reworks_dynamics_from_0_09 ConstraintsTest.java Log Message: Branched and added Nat's latest reworking of the dynamic libraries Index: ConstraintsTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/constraint/ConstraintsTest.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ConstraintsTest.java 18 May 2003 20:59:40 -0000 1.2 +++ ConstraintsTest.java 21 Jun 2003 14:01:08 -0000 1.2.2.1 @@ -4,15 +4,14 @@ */ package test.mockobjects.constraint; -import com.mockobjects.constraint.*; -import com.mockobjects.dynamic.Mock; -import com.mockobjects.util.AssertMo; +import java.util.EventObject; +import junit.framework.TestCase; import test.mockobjects.dynamic.DummyInterface; -import java.util.EventObject; - -import junit.framework.*; +import com.mockobjects.constraint.*; +import com.mockobjects.dynamic.Mock; +import com.mockobjects.util.AssertMo; public class ConstraintsTest extends TestCase { |
From: Steve F. <sm...@us...> - 2003-06-21 14:01:11
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/util In directory sc8-pr-cvs1:/tmp/cvs-serv11585/src/core/com/mockobjects/util Modified Files: Tag: Nat_reworks_dynamics_from_0_09 TestCaseMo.java Verifier.java SuiteBuilder.java AssertMo.java Log Message: Branched and added Nat's latest reworking of the dynamic libraries Index: TestCaseMo.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/util/TestCaseMo.java,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -u -r1.3 -r1.3.6.1 --- TestCaseMo.java 1 Nov 2002 15:37:28 -0000 1.3 +++ TestCaseMo.java 21 Jun 2003 14:01:08 -0000 1.3.6.1 @@ -1,7 +1,8 @@ package com.mockobjects.util; -import junit.framework.*; import junit.awtui.TestRunner; +import junit.framework.TestCase; + import com.mockobjects.Verifiable; /** Index: Verifier.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/util/Verifier.java,v retrieving revision 1.5 retrieving revision 1.5.6.1 diff -u -r1.5 -r1.5.6.1 --- Verifier.java 29 Sep 2002 16:44:28 -0000 1.5 +++ Verifier.java 21 Jun 2003 14:01:08 -0000 1.5.6.1 @@ -1,11 +1,11 @@ package com.mockobjects.util; -import com.mockobjects.Verifiable; - import java.lang.reflect.Field; import java.util.Vector; import junit.framework.Assert; + +import com.mockobjects.Verifiable; /** * Helper class to verify all {@link com.mockobjects.Expectation Expectation}s Index: SuiteBuilder.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/util/SuiteBuilder.java,v retrieving revision 1.1 retrieving revision 1.1.8.1 diff -u -r1.1 -r1.1.8.1 --- SuiteBuilder.java 29 Jul 2001 19:50:24 -0000 1.1 +++ SuiteBuilder.java 21 Jun 2003 14:01:08 -0000 1.1.8.1 @@ -1,7 +1,9 @@ package com.mockobjects.util; -import junit.framework.*; -import java.lang.reflect.*; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import junit.framework.TestSuite; /** * Singleton to fill in a JUnit Test composite for use in a suite method. Index: AssertMo.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/util/AssertMo.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- AssertMo.java 18 May 2003 20:59:40 -0000 1.3 +++ AssertMo.java 21 Jun 2003 14:01:08 -0000 1.3.2.1 @@ -3,6 +3,7 @@ import junit.framework.Assert; import junit.framework.AssertionFailedError; + import com.mockobjects.Verifiable; public class AssertMo extends Assert { |
From: Steve F. <sm...@us...> - 2003-06-21 14:01:10
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects In directory sc8-pr-cvs1:/tmp/cvs-serv11585/src/core/com/mockobjects Modified Files: Tag: Nat_reworks_dynamics_from_0_09 AbstractExpectationCollection.java Log Message: Branched and added Nat's latest reworking of the dynamic libraries Index: AbstractExpectationCollection.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/AbstractExpectationCollection.java,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -r1.7 -r1.7.2.1 --- AbstractExpectationCollection.java 18 May 2003 20:59:36 -0000 1.7 +++ AbstractExpectationCollection.java 21 Jun 2003 14:01:08 -0000 1.7.2.1 @@ -2,8 +2,8 @@ import java.util.Collection; import java.util.Enumeration; -import java.util.Iterator; import java.util.HashSet; +import java.util.Iterator; abstract public class AbstractExpectationCollection extends AbstractExpectation implements ExpectationCollection { |
From: Steve F. <sm...@us...> - 2003-06-21 14:01:10
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/tools In directory sc8-pr-cvs1:/tmp/cvs-serv11585/src/core/com/mockobjects/tools Added Files: Tag: Nat_reworks_dynamics_from_0_09 Boxer.java Log Message: Branched and added Nat's latest reworking of the dynamic libraries --- NEW FILE: Boxer.java --- /** Created on Jun 19, 2003 by npryce * Copyright (c) B13media Ltd. */ package com.mockobjects.tools; import java.io.FileWriter; import java.io.PrintWriter; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.*; public class Boxer { static final String INDENT1 = " "; static final String INDENT2 = INDENT1+INDENT1; static final Map BOXES = new HashMap(); static { BOXES.put( boolean.class, Boolean.class ); BOXES.put( byte.class, Byte.class ); BOXES.put( short.class, Short.class ); BOXES.put( int.class, Integer.class ); BOXES.put( long.class, Long.class ); BOXES.put( float.class, Float.class ); BOXES.put( double.class, Double.class ); BOXES.put( char.class, Character.class ); } static String nameOfClass( String className ) { int dotIndex = className.lastIndexOf('.'); if (dotIndex >= 0) { return className.substring(dotIndex + 1); } else { return className; } } static String packageOfClass( String className ) { int dotIndex = className.lastIndexOf('.'); if (dotIndex >= 0) { return className.substring(0, dotIndex); } else { return null; } } static boolean classHasPackage( String className ) { return className.lastIndexOf('.') > 0; } static boolean isPackageScope( int modifiers ) { return !Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers) && !Modifier.isPrivate(modifiers); } static String parameterName( int i ) { return "arg" + i; } static String typeSyntax( Class c ) { if( c.isPrimitive() ) { return c.toString(); } else if( c.isArray() ) { return typeSyntax(c.getComponentType()) + "[]"; } else { return c.getName(); } } static void generateFormalParameter( PrintWriter out, Class parameterType, int i ) { out.print( typeSyntax(parameterType) ); out.print( " " ); out.print( parameterName(i) ); } static void generateFormalParameters( PrintWriter out, Class[] parameterTypes ) { out.print("("); for( int i = 0; i < parameterTypes.length; i++ ) { if( i > 0 ) out.print( ", "); generateFormalParameter( out, parameterTypes[i], i ); } out.print(")"); } static void generateThrowsClause( PrintWriter out, Class[] exceptionTypes ) { if( exceptionTypes.length > 0 ) { out.print(" throws "); for( int i = 0; i < exceptionTypes.length; i++ ) { if( i > 0 ) out.print(", "); out.print( exceptionTypes[i].getName() ); } } } static void generateActualParameters( PrintWriter out, Class[] parameterTypes ) { for( int i = 0; i < parameterTypes.length; i++ ) { if( i > 0 ) out.print(", "); out.print( parameterName(i) ); } } static void generateSuperConstructorCall( PrintWriter out, Constructor c ) { out.print(INDENT2); out.print("super("); generateActualParameters( out, c.getParameterTypes() ); out.println(");"); } static void generateConstructor( PrintWriter out, Constructor c, String className ) { out.print(INDENT1); out.print("public "); out.print(nameOfClass(className)); generateFormalParameters( out, c.getParameterTypes() ); generateThrowsClause( out, c.getExceptionTypes() ); out.println( " {" ); generateSuperConstructorCall( out, c ); out.print(INDENT1); out.println("}"); } static void generateConstructors( PrintWriter out, Class template, String className ) { Constructor[] constructors = template.getDeclaredConstructors(); boolean canCallPackageMethods = template.getPackage().getName().equals( packageOfClass(className) ); for( int i = 0; i < constructors.length; i++ ) { Constructor c = constructors[i]; if( Modifier.isProtected(c.getModifiers()) || Modifier.isPublic(c.getModifiers()) || (isPackageScope(c.getModifiers()) && canCallPackageMethods) ) { if( i > 0 ) out.println(); generateConstructor( out, c, className ); } } } static List expandOverloadsForParameter( List overloads, int parameterIndex ) { List expandedOverloads = new ArrayList(); for( Iterator oi = overloads.iterator(); oi.hasNext(); ) { Class[] arguments = (Class[])oi.next(); for( Iterator bi = BOXES.keySet().iterator(); bi.hasNext(); ) { Class primitiveType = (Class)bi.next(); Class[] overloadedArguments = (Class[])arguments.clone(); overloadedArguments[parameterIndex] = primitiveType; expandedOverloads.add(overloadedArguments); } } return expandedOverloads; } static List listOverloadsForMethod( Class[] parameterTypes ) { List overloads = new ArrayList(); overloads.add(parameterTypes); for( int i = 0; i < parameterTypes.length; i++ ) { if( parameterShouldBeBoxed(parameterTypes[i]) ) { overloads = expandOverloadsForParameter( overloads, i ); } } return overloads; } static void generateBoxExpression( PrintWriter out, Class primitiveType, String parameterName ) { Class boxClass = (Class)BOXES.get(primitiveType); out.print( "new " ); out.print( nameOfClass(boxClass.getName()) ); out.print( "(" ); out.print( parameterName ); out.print( ")" ); } static void generateSuperCallForOverloadedMethod( PrintWriter out, Method m, Class[] overloadedParameterTypes ) { Class[] originalParameterTypes = m.getParameterTypes(); out.print(INDENT2); out.print("super."); out.print(m.getName()); out.print("("); for( int i = 0; i < originalParameterTypes.length; i++ ) { if( i > 0 ) out.print(", "); if( parameterShouldBeBoxed(originalParameterTypes[i]) ) { generateBoxExpression( out, overloadedParameterTypes[i], parameterName(i) ); } else { out.print( parameterName(i) ); } } out.println(");"); } static boolean parameterShouldBeBoxed( Class type ) { return type == Object.class; } static void generateOverloadedMethod( PrintWriter out, Method m, Class[] overloadedParameterTypes ) { out.print(INDENT1); out.print("public "); out.print(m.getReturnType()); out.print(" "); out.print(m.getName()); generateFormalParameters( out, overloadedParameterTypes ); generateThrowsClause( out, m.getExceptionTypes() ); out.println(" {"); generateSuperCallForOverloadedMethod( out, m, overloadedParameterTypes ); out.print(INDENT1); out.println("}"); } static void generateOverloadsForMethod( PrintWriter out, Method m ) { List overloads = listOverloadsForMethod( m.getParameterTypes() ); if( overloads.size() > 1 ) { for( Iterator i = overloads.iterator(); i.hasNext(); ) { out.println(); generateOverloadedMethod( out, m, (Class[])i.next() ); } } } static void generateBoxerMethods( PrintWriter out, Class template ) { Method[] methods = template.getDeclaredMethods(); for( int i = 0; i < methods.length; i++ ) { Method m = methods[i]; if( Modifier.isPublic(m.getModifiers()) ) { generateOverloadsForMethod( out, m ); } } } static void generateBoxerClass( PrintWriter out, Class template, String className ) { out.println( "// WARNING: DO NOT EDIT" ); out.println( "// This file was automatically generated by the Boxer " + "(floats like a butterfly, strings like a bee)" ); out.println( "// Generated on " + (new Date()) ); out.println(); if( classHasPackage(className) ) { out.println( "package " + packageOfClass(className) + ";" ); out.println(); } out.print("public class "); out.print( nameOfClass(className) ); out.print(" extends "); out.print( template.getName() ); out.println( " {" ); generateConstructors( out, template, className ); generateBoxerMethods( out, template ); out.println( "}" ); } public static void main(String[] args) { if( args.length < 2 || args.length > 3 ) { System.err.println( "usage: java " + Boxer.class + " <template-class> <generated-class> [<output-file>]" ); System.exit(1); } try { Class templateClass = Class.forName( args[0] ); String generatedClassName = args[1]; PrintWriter out; if( args.length == 3 ) { out = new PrintWriter(new FileWriter(args[2])); } else { out = new PrintWriter(System.out); } generateBoxerClass( out, templateClass, generatedClassName ); out.flush(); if( args.length == 3 ) { System.out.println( "generated " + generatedClassName + " in file " + args[2] ); out.close(); } } catch( Exception ex ) { ex.printStackTrace(); System.exit(2); } } } |
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv11585/src/core/test/mockobjects/dynamic Modified Files: Tag: Nat_reworks_dynamics_from_0_09 StubTest.java MockConstraint.java DynamicUtilTest.java CallOnceExpectationTest.java MockCallable.java CallSequenceTest.java MockCallFactory.java CTest.java MockTest.java Added Files: Tag: Nat_reworks_dynamics_from_0_09 NameMatcherTest.java CallDecoratorTest.java ActiveCallTest.java ArgumentMatcherTest.java CallSelectionTest.java CallCollectionBuilderTest.java MockCompositeCallable.java Removed Files: Tag: Nat_reworks_dynamics_from_0_09 CallMatchTest.java ConstraintMatcherTest.java CallBagTest.java MockCallableAddable.java MockConstraintMatcher.java Log Message: Branched and added Nat's latest reworking of the dynamic libraries --- NEW FILE: NameMatcherTest.java --- /** Created on Jun 12, 2003 by npryce * Copyright (c) B13media Ltd. */ package test.mockobjects.dynamic; import junit.framework.TestCase; import com.mockobjects.dynamic.ActiveCall; import com.mockobjects.dynamic.NameMatcher; public class NameMatcherTest extends TestCase { private final String METHOD_NAME = "methodName"; private final Object[] ARGS = { "arg1", "arg2" }; private final MockCallable delegate = new MockCallable(); private final ActiveCall CALL = new ActiveCall( METHOD_NAME, new Class[] { String.class, String.class }, String.class, ARGS ); private final NameMatcher callName = new NameMatcher( METHOD_NAME, delegate ); public NameMatcherTest(String name) { super(name); } public void testReturnsMethodNameAsDescription() { assertEquals( "expected method name as description", METHOD_NAME, callName.getDescription() ); } public void testReturnsMethodNameFromGetMethodName() { assertEquals( "expected method name", METHOD_NAME, callName.getMethodName() ); } public void testPassesMatchToDelegateIfMethodHasTheSameName() { delegate.setExpectedMatches( CALL ); delegate.setupMatchesReturn(true); callName.matches( CALL ); delegate.verifyExpectations(); } public void testReturnsMatchResultFromDelegateIfMethodHasTheSameName() { delegate.setExpectedMatches( CALL ); delegate.setupMatchesReturn(true); assertTrue( "expected matches to return true", callName.matches( CALL ) ); delegate.verifyExpectations(); delegate.setExpectedMatches( CALL ); delegate.setupMatchesReturn(false); assertFalse( "expected matches to return false", callName.matches( CALL ) ); delegate.verifyExpectations(); } public void testMatchFailsIfMethodNameIsDifferent() { final ActiveCall OTHER_CALL = new ActiveCall( "other_" + METHOD_NAME, new Class[] { String.class, String.class }, String.class, ARGS ); delegate.setExpectedMatchesCount(0); assertFalse( "expected matches to return false with other method name", callName.matches( OTHER_CALL ) ); delegate.verifyExpectations(); } public void testMatchesAnyMethodWithTheGivenNameWhateverTheArguments() { delegate.setupMatchesReturn(true); final ActiveCall CALL0 = new ActiveCall( METHOD_NAME, new Class[0], String.class, new Object[0] ); assertTrue( "expected matches to return true", callName.matches(CALL0) ); final ActiveCall CALL1 = new ActiveCall( METHOD_NAME, new Class[] { String.class }, String.class, new Object[]{"arg1"} ); assertTrue( "expected matches to return true", callName.matches(CALL1) ); final ActiveCall CALL2 = new ActiveCall( METHOD_NAME, new Class[] { String.class, String.class }, String.class, new Object[]{"arg1","arg2"} ); assertTrue( "expected matches to return true", callName.matches(CALL2) ); final ActiveCall CALL3 = new ActiveCall( METHOD_NAME, new Class[] { String.class, String.class, String.class }, String.class, new Object[]{"arg1","arg2","arg3"} ); assertTrue( "expected matches to return true", callName.matches(CALL3) ); } } --- NEW FILE: CallDecoratorTest.java --- /* * Created on 04-Apr-2003 */ package test.mockobjects.dynamic; import junit.framework.TestCase; import com.mockobjects.dynamic.ActiveCall; import com.mockobjects.dynamic.CallDecorator; public class CallDecoratorTest extends TestCase { private static final Object[] METHOD_ARGS = { "arg1", "arg2" }; private static final String METHOD_NAME = "methodName"; private static final ActiveCall CALL = new ActiveCall( METHOD_NAME, new Class[] { String.class, String.class }, String.class, METHOD_ARGS ); MockCallable mockCallable = new MockCallable(); CallDecorator callDecorator = new CallDecorator(mockCallable); public CallDecoratorTest(String name) { super(name); } public void testPropagatesCallArgumentsToDecorated() throws Throwable { final Object result = "result"; mockCallable.setExpectedCall(CALL); mockCallable.setupCallReturn(result); callDecorator.call(CALL); mockCallable.verifyExpectations(); } public void testPropagatesResultFromDecorated() throws Throwable { final Object result = "result"; mockCallable.setExpectedCall(CALL); mockCallable.setupCallReturn(result); Object actual_result = callDecorator.call(CALL); assertSame( "result should be propagated back from decorated", result, actual_result ); mockCallable.verifyExpectations(); } public void testPropagatesExceptionsFromDecorated() throws Throwable { final Throwable thrown = new Throwable("thrown"); mockCallable.setExpectedCall(CALL); mockCallable.setupCallThrow(thrown); try { callDecorator.call(CALL); fail("expected exception to be thrown"); } catch( Throwable t ) { assertSame( "exception should be propagated back from decorated", thrown, t ); } mockCallable.verifyExpectations(); } public void testPropagatesVerifyToDecorated() { mockCallable.setExpectedVerifyCalls(1); callDecorator.verify(); mockCallable.verifyExpectations(); } public void testPropagatesMatchesArgumentsToDecorated() throws Throwable { mockCallable.setExpectedMatches(CALL); mockCallable.setupMatchesReturn(true); callDecorator.matches(CALL); mockCallable.verifyExpectations(); } public void testPropagatesMatchesSuccessFromDecorated() throws Throwable { mockCallable.setupMatchesReturn(true); assertTrue( "matches should return true", callDecorator.matches(CALL) ); mockCallable.verifyExpectations(); } public void testPropagatesMatchesFailureFromDecorated() throws Throwable { mockCallable.setupMatchesReturn(false); assertFalse( "matches should return false", callDecorator.matches(CALL) ); mockCallable.verifyExpectations(); } } --- NEW FILE: ActiveCallTest.java --- /** Created on Jun 17, 2003 by npryce * Copyright (c) B13media Ltd. */ package test.mockobjects.dynamic; import java.lang.reflect.Method; import java.util.Arrays; import junit.framework.TestCase; import com.mockobjects.dynamic.ActiveCall; public class ActiveCallTest extends TestCase { public String exampleMethod( int number, boolean flag ) { return "hello, world"; } final String METHOD_NAME = "exampleMethod"; final Class[] ARG_TYPES = { int.class, boolean.class }; final Class RETURN_TYPE = String.class; final Object[] ARG_VALUES = { new Integer(0), Boolean.TRUE }; public ActiveCallTest(String name) { super(name); } public void testCanBeConstructedWithExplicitCallDetails() { ActiveCall call = new ActiveCall( METHOD_NAME, ARG_TYPES, RETURN_TYPE, ARG_VALUES ); assertEquals( "name", METHOD_NAME, call.getName() ); assertEquals( "parameter types", Arrays.asList(ARG_TYPES), call.getParameterTypes() ); assertEquals( "return type", RETURN_TYPE, call.getReturnType() ); assertEquals( "argument values", Arrays.asList(ARG_VALUES), call.getParameterValues() ); } public void testCanBeConstructedFromAMethodObject() throws Exception { Method method = getClass().getMethod( METHOD_NAME, ARG_TYPES ); ActiveCall call = new ActiveCall( method, ARG_VALUES ); assertEquals( "name", method.getName(), call.getName() ); assertEquals( "parameter types", Arrays.asList(method.getParameterTypes()), call.getParameterTypes() ); assertEquals( "return type", method.getReturnType(), call.getReturnType() ); assertEquals( "argument values", Arrays.asList(ARG_VALUES), call.getParameterValues() ); } public void testConstructorInterpretsNullParameterValueArrayAsZeroArguments() { ActiveCall call = new ActiveCall( METHOD_NAME, new Class[0], RETURN_TYPE, null ); assertEquals( "expected no parameters values", 0, call.getParameterValues().size() ); } public void testTestsForEqualityOnMethodSignatureAndArguments() { ActiveCall call1 = new ActiveCall( METHOD_NAME, (Class[])ARG_TYPES.clone(), RETURN_TYPE, (Object[])ARG_VALUES.clone() ); ActiveCall call2 = new ActiveCall( METHOD_NAME, (Class[])ARG_TYPES.clone(), RETURN_TYPE, (Object[])ARG_VALUES.clone() ); ActiveCall differentName = new ActiveCall( "other" + METHOD_NAME, (Class[])ARG_TYPES.clone(), RETURN_TYPE, (Object[])ARG_VALUES.clone() ); ActiveCall differentReturnType = new ActiveCall( "other" + METHOD_NAME, (Class[])ARG_TYPES.clone(), int.class, (Object[])ARG_VALUES.clone() ); ActiveCall differentArgTypes = new ActiveCall( "other" + METHOD_NAME, new Class[]{double.class}, RETURN_TYPE, (Object[])ARG_VALUES.clone() ); ActiveCall differentArgValues = new ActiveCall( "other" + METHOD_NAME, (Class[])ARG_TYPES.clone(), RETURN_TYPE, new Object[] { new Integer(1), Boolean.FALSE } ); assertTrue( "should be equal to itself", call1.equals(call1) ); assertTrue( "identical calls should be equal", call1.equals(call2) ); assertFalse( "should not be equal to object that is not an ActiveCall", call1.equals(new Object()) ); assertFalse( "should not be equal to null", call1.equals(null) ); assertFalse( "should not be equal if different name", call1.equals(differentName) ); assertFalse( "should not be equal if different parameter types", call1.equals(differentArgTypes) ); assertFalse( "should not be equal if different return type", call1.equals(differentReturnType) ); assertFalse( "should not be equal if different argumentValues", call1.equals(differentArgValues) ); } public void testFollowsEqualsHashcodeProtocol() { ActiveCall call1 = new ActiveCall( METHOD_NAME, (Class[])ARG_TYPES.clone(), RETURN_TYPE, (Object[])ARG_VALUES.clone() ); ActiveCall call2 = new ActiveCall( METHOD_NAME, (Class[])ARG_TYPES.clone(), RETURN_TYPE, (Object[])ARG_VALUES.clone() ); assertEquals( "should have equal hash codes", call1.hashCode(), call2.hashCode() ); } } --- NEW FILE: ArgumentMatcherTest.java --- /* * Created on 04-Apr-2003 */ package test.mockobjects.dynamic; import junit.framework.TestCase; import com.mockobjects.constraint.Constraint; import com.mockobjects.dynamic.ActiveCall; import com.mockobjects.dynamic.ArgumentMatcher; public class ArgumentMatcherTest extends TestCase { private final String METHOD_NAME = "methodName"; private final MockCallable mockCallable = new MockCallable(); public ArgumentMatcherTest(String name) { super(name); } // Note: CallSignature extends CallDecorator (indirectly) and only // overrides the matches method. Therefore the only tests that // need to be written are those that exercise the matches method. // All other tests have been removed from this test class. // --Nat. public void setUp() { mockCallable.setupMatchesReturn(true); } public void testDoesNotMatchDifferentName() throws Throwable { final ActiveCall call = new ActiveCall( "otherName", new Class[0], void.class, null ); ArgumentMatcher callSignature = new ArgumentMatcher( METHOD_NAME, new Constraint[0], mockCallable ); assertFalse( "call should not match", callSignature.matches(call) ); mockCallable.verifyExpectations(); } public void testDoesNotMatchWhenTooManyArguments() throws Throwable { String[] args = { "arg1", "arg2" }; ActiveCall call = new ActiveCall( METHOD_NAME, new Class[]{String.class,String.class}, void.class, args ); Constraint[] constraints = { new MockConstraint("constraint1", args[0], true) }; ArgumentMatcher callSignature = new ArgumentMatcher( METHOD_NAME, constraints, mockCallable ); assertFalse( "should not match if too many arguments", callSignature.matches(call) ); } public void testDoesNotMatchWhenTooFewArguments() throws Throwable { String[] args = { "arg1" }; ActiveCall call = new ActiveCall( METHOD_NAME, new Class[]{String.class}, void.class, args ); Constraint[] constraints = { new MockConstraint("constraint1", args[0], true), new MockConstraint("constraint2", args[0], true) }; ArgumentMatcher callSignature = new ArgumentMatcher( METHOD_NAME, constraints, mockCallable ); assertFalse( "should not match if too few arguments", callSignature.matches(call) ); } public void testDoesNotMatchWhenConstraintIsViolated() throws Throwable { String[] args = { "argA", "argB", "argC" }; ActiveCall call = new ActiveCall( METHOD_NAME, new Class[]{String.class,String.class,String.class}, void.class, args ); Constraint[] constraints = { new MockConstraint("constraintA", args[0], true), new MockConstraint("constraintB", args[1], false), new MockConstraint("constraintC", args[2], true) }; ArgumentMatcher callSignature = new ArgumentMatcher( METHOD_NAME, constraints, mockCallable ); assertFalse( "should not match if constraint is violated", callSignature.matches(call) ); } public void testDoesNotMatchWithNoArgumentsAndCalleeHasArguments() throws Throwable { String[] args = new String[] { "arg1", "arg2" }; ActiveCall call = new ActiveCall( METHOD_NAME, new Class[]{String.class,String.class}, void.class, args ); Constraint[] constraints = new MockConstraint[0]; ArgumentMatcher callSignature = new ArgumentMatcher( METHOD_NAME, constraints, mockCallable ); assertFalse( "should not match", callSignature.matches(call) ); } public void testMatchesWithNoArguments() throws Throwable { String[] args = new String[0]; ActiveCall call = new ActiveCall( METHOD_NAME, new Class[0], void.class, args ); Constraint[] constraints = new MockConstraint[0]; ArgumentMatcher callSignature = new ArgumentMatcher( METHOD_NAME, constraints, mockCallable ); assertTrue( "should match", callSignature.matches(call) ); } public void testMatchesWhenConstraintsPass() throws Throwable { String[] args = { "argA", "argB", "argC" }; ActiveCall call = new ActiveCall( METHOD_NAME, new Class[]{ String.class, String.class, String.class }, void.class, args ); MockConstraint constraintA = new MockConstraint("constraintA", args[0], true); MockConstraint constraintB = new MockConstraint("constraintB", args[1], true); MockConstraint constraintC = new MockConstraint("constraintC", args[2], true); Constraint[] constraints = { constraintA, constraintB, constraintC }; ArgumentMatcher callSignature = new ArgumentMatcher( METHOD_NAME, constraints, mockCallable ); assertTrue( "should match", callSignature.matches(call) ); constraintA.verify(); constraintB.verify(); constraintC.verify(); } public void testChecksThatDelegateMatchesWhenConstraintsMatch() throws Throwable { String[] args = { "argA", "argB", "argC" }; ActiveCall call = new ActiveCall( METHOD_NAME, new Class[]{ String.class, String.class, String.class }, void.class, args ); MockConstraint constraintA = new MockConstraint("constraintA", args[0], true); MockConstraint constraintB = new MockConstraint("constraintB", args[1], true); MockConstraint constraintC = new MockConstraint("constraintC", args[2], true); Constraint[] constraints = { constraintA, constraintB, constraintC }; mockCallable.setExpectedMatches(call); mockCallable.setupMatchesReturn(false); ArgumentMatcher callSignature = new ArgumentMatcher( METHOD_NAME, constraints, mockCallable ); assertFalse( "should not match", callSignature.matches(call) ); mockCallable.verifyExpectations(); } } --- NEW FILE: CallSelectionTest.java --- package test.mockobjects.dynamic; import junit.framework.AssertionFailedError; import junit.framework.TestCase; import com.mockobjects.constraint.Constraint; import com.mockobjects.dynamic.*; import com.mockobjects.util.AssertMo; public class CallSelectionTest extends TestCase { final String METHOD_A_NAME = "methodA"; final String METHOD_A_RESULT = "resultA"; final Throwable METHOD_A_EXCEPTION = new DummyThrowable("Configured test throwable"); final String[] METHOD_A_ARGS = new String[] { "a1", "a2" }; final Constraint[] METHOD_A_CONSTRAINTS = C.args(C.eq("a1"), C.eq("a2")); final ActiveCall CALL_A = new ActiveCall( METHOD_A_NAME, new Class[]{String.class,String.class}, String.class, METHOD_A_ARGS ); final String METHOD_B_NAME = "methodB"; final String METHOD_B_RESULT = "resultB"; final String[] METHOD_B_ARGS = new String[] { "b1", "b2" }; final ActiveCall CALL_B = new ActiveCall( METHOD_B_NAME, new Class[]{String.class,String.class}, String.class, METHOD_B_ARGS ); final String METHOD_C_NAME = "methodC"; final String[] METHOD_C_ARGS = { "c1", "c2" }; final ActiveCall CALL_C = new ActiveCall( METHOD_C_NAME, new Class[]{String.class,String.class}, Void.class, METHOD_C_ARGS ); private CallSelection callSelection = new CallSelection(); private MockCallable methodA = new MockCallable(); private MockCallable methodB = new MockCallable(); private MockCallable mockCallable = new MockCallable(); public CallSelectionTest(String name) { super(name); } public void testCallFailsOnEmptySet() throws Throwable { try { callSelection.call(CALL_A); } catch (AssertionFailedError ex) { AssertMo.assertIncludes( "reports empty set in error message", "no methods", ex.getMessage()); return; } fail("Should fail for a missing item"); } public void testCallPassedToContainedElementsInReverseOrderOfAddition() throws Throwable { methodA.setExpectedMatches(CALL_A); methodA.setupMatchesReturn(true); methodA.setExpectedCall(CALL_A); methodA.setupCallReturn(METHOD_A_RESULT); methodB.setExpectedMatches(CALL_A); methodB.setupMatchesReturn(false); callSelection.addCallable(methodA); callSelection.addCallable(methodB); assertSame("expected result from method A", METHOD_A_RESULT, callSelection.call(CALL_A)); methodA.verifyExpectations(); methodB.verifyExpectations(); } public void testMatchedCallStopsSearch() throws Throwable { methodA.setExpectedCallCount(0); methodB.setExpectedMatches(CALL_B); methodB.setupMatchesReturn(true); methodB.setExpectedCall(CALL_B); methodB.setupCallReturn(METHOD_B_RESULT); callSelection.addCallable(methodA); callSelection.addCallable(methodB); assertSame( "expected result from method B", METHOD_B_RESULT, callSelection.call(CALL_B)); methodA.verifyExpectations(); methodB.verifyExpectations(); } public void testExpectationsOverrideEarlierMatchingExpectations() throws Throwable { Callable methodASignature = new ArgumentMatcher( METHOD_A_NAME, METHOD_A_CONSTRAINTS, new ReturnStub("result1")); Callable anotherMethodASignature = new ArgumentMatcher( METHOD_A_NAME, METHOD_A_CONSTRAINTS, new ReturnStub("result2")); callSelection.addCallable(methodASignature); callSelection.addCallable(new CallOnceExpectation(anotherMethodASignature)); assertSame( "expected result from method A", "result2", callSelection.call(CALL_A)); callSelection.verify(); } public void testConfiguredResultReturned() throws Throwable { mockCallable.setupCallReturn(METHOD_A_RESULT); mockCallable.setupMatchesReturn(true); callSelection.addCallable(mockCallable); assertSame( "result is returned by mock", METHOD_A_RESULT, callSelection.call(CALL_A)); } public void testCallableThrowableThrown() throws Throwable { mockCallable.setupMatchesReturn(true); mockCallable.setupCallThrow(METHOD_A_EXCEPTION); callSelection.addCallable(mockCallable); try { callSelection.call(CALL_A); } catch (Throwable ex) { assertSame("exception is caught by mock", METHOD_A_EXCEPTION, ex); } } public void testEmptySetVerifies() throws Exception { callSelection.verify(); } public void testReportsFailureIfNoElementMatches() throws Throwable { methodA.setExpectedMatches(CALL_C); methodA.setupMatchesReturn(false); methodA.setExpectedCallCount(0); methodA.setupGetDescription("***methodA-description****"); methodB.setExpectedCall(CALL_C); methodB.setupMatchesReturn(false); methodB.setExpectedCallCount(0); methodB.setupGetDescription("***methodB-description****"); callSelection.addCallable(methodA); callSelection.addCallable(methodB); try { callSelection.call(CALL_C); } catch (AssertionFailedError ex) { AssertMo.assertIncludes("method name is in error message", "methodC", ex.getMessage()); AssertMo.assertIncludes("argument is in error message (1)", METHOD_C_ARGS[0], ex.getMessage()); AssertMo.assertIncludes("argument is in error message (2)", METHOD_C_ARGS[1], ex.getMessage()); AssertMo.assertIncludes("shows set contents (A)", methodA.getDescription(), ex.getMessage()); AssertMo.assertIncludes("shows set contents (B)", methodB.getDescription(), ex.getMessage()); return; } fail("Should fail for a missing item"); } public void testVerifiesIfAllContainedElementsVerify() throws Throwable { methodA.setExpectedVerifyCalls(1); methodB.setExpectedVerifyCalls(1); callSelection.addCallable(methodA); callSelection.addCallable(methodB); callSelection.verify(); methodA.verifyExpectations(); methodB.verifyExpectations(); } public void testVerifyFailsIfContainedElementDoesNotVerify() throws Exception { methodA.setExpectedVerifyCalls(1); methodA.setupVerifyThrow(new AssertionFailedError("verify failed")); callSelection.addCallable(methodA); try { callSelection.verify(); } catch (AssertionFailedError ex) { methodA.verifyExpectations(); return; } fail("Should have got a failure for contained element failing"); } public void testDoesNotMatchIfEmpty() { assertTrue( "empty selection does not match", !callSelection.matches(CALL_A) ); } public void testPassesMatchesParametersToAllElements() { callSelection.addCallable( methodA ); callSelection.addCallable( methodB ); methodA.setExpectedMatches(CALL_A); methodA.setupMatchesReturn(true); methodB.setExpectedMatches(CALL_A); methodA.setupMatchesReturn(true); assertTrue( "should match", callSelection.matches(CALL_A) ); callSelection.verify(); } public void testMatchesIfAnyExpectedElementMatches() { callSelection.addCallable( methodA ); callSelection.addCallable( methodB ); methodA.setupMatchesReturn(true); methodB.setupMatchesReturn(false); assertTrue( "should match methodA", callSelection.matches(CALL_A) ); methodA.setupMatchesReturn(false); methodB.setupMatchesReturn(true); assertTrue( "should match methodB", callSelection.matches(CALL_B) ); } public void testDoesNotMatchIfNoElementsMatch() { callSelection.addCallable( methodA ); callSelection.addCallable( methodB ); methodA.setExpectedMatches(CALL_C); methodA.setupMatchesReturn(false); methodB.setExpectedMatches(CALL_C); methodB.setupMatchesReturn(false); assertFalse( "no method should match", callSelection.matches(CALL_C) ); } } --- NEW FILE: CallCollectionBuilderTest.java --- /* * Created on 04-Apr-2003 */ package test.mockobjects.dynamic; import junit.framework.TestCase; import com.mockobjects.constraint.Constraint; import com.mockobjects.constraint.IsEqual; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.CallCollectionBuilder; import com.mockobjects.util.Verifier; public class CallCollectionBuilderTest extends TestCase { final String METHOD_NOARG_NAME = "noArgMethodVoid"; final String METHOD_NOARGANDRETURN_NAME = "noArgMethod"; final String METHOD_NOARGANDRETURN_RESULT = "resultNoArgs"; final String METHOD_ONEARG_NAME = "oneArgMethod"; final String METHOD_ONEARG_RESULT = "result1Args"; final String METHOD_TWOARG_NAME = "twoArgMethod"; final String METHOD_TWOARG_RESULT = "resultTwoArgs"; final Throwable METHOD_EXCEPTION = new DummyThrowable("Configured test throwable"); final Object[] METHOD_NOARG_ARGS = new Object[0]; final String[] METHOD_ONEARG_ARGS = new String[] { "oneP1" }; final Constraint[] METHOD_ONEARG_CONSTRAINTS = C.args(C.eq("oneP1")); final String[] METHOD_TWOARG_ARGS = new String[] { "twoP1", "twoP2" }; final Constraint[] METHOD_TWOARG_CONSTRAINTS = C.args(C.eq("twoP1"), C.eq("twoP2")); private MockCallFactory mockCallFactory = new MockCallFactory(); private MockCallable mockCallable = new MockCallable(); private MockCallable mockArgumentMatcher = new MockCallable(); private MockCallable mockCallOnceExpectation = new MockCallable(); private MockCallable mockReturnStub = new MockCallable(); private MockCallable mockThrowStub = new MockCallable(); private MockCallable mockVoidStub = new MockCallable(); private MockCompositeCallable mockCompositeCallable = new MockCompositeCallable(); private CallCollectionBuilder builder; public CallCollectionBuilderTest(String name) throws Exception { super(name); } public void setUp() { builder = new CallCollectionBuilder( mockCallFactory, mockCompositeCallable ); } public void testAddsCallablesToComposite() throws Throwable { mockCompositeCallable.addExpectedAddCallableValues( mockCallable ); builder.addCallable( mockCallable ); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorToWrapExpectedCallableObject() throws Throwable { mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, mockCallable ); mockCallFactory.setupCreateArgumentMatcher( mockArgumentMatcher ); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher ); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation ); mockCompositeCallable.addExpectedAddCallableValues(mockCallOnceExpectation); builder.expect( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, mockCallable ); mockCallFactory.verify(); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectVoidWithConstraintArray() throws Throwable { mockCallFactory.setExpectedCreateVoidStubCalls(1); mockCallFactory.setupCreateVoidStub(mockVoidStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, mockVoidStub ); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher ); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation); builder.expectVoid(METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectAndReturnWithNoArguments() throws Throwable { mockCallFactory.addExpectedCreateReturnStubValues( METHOD_NOARGANDRETURN_RESULT); mockCallFactory.setupCreateReturnStub(mockReturnStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_NOARGANDRETURN_NAME, C.NO_ARGS, mockReturnStub); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher ); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation ); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation ); builder.expectAndReturn( METHOD_NOARGANDRETURN_NAME, METHOD_NOARGANDRETURN_RESULT ); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectAndThrowWithNoArguments() throws Throwable { mockCallFactory.addExpectedCreateThrowStubValues( METHOD_EXCEPTION ); mockCallFactory.setupCreateThrowStub(mockThrowStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_NOARGANDRETURN_NAME, C.NO_ARGS, mockThrowStub ); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation ); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation ); builder.expectAndThrow(METHOD_NOARGANDRETURN_NAME, METHOD_EXCEPTION); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectAndThrowWithOneArgument() throws Throwable { mockCallFactory.addExpectedCreateThrowStubValues(METHOD_EXCEPTION); mockCallFactory.setupCreateThrowStub(mockThrowStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS, mockThrowStub ); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation ); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation ); builder.expectAndThrow( METHOD_ONEARG_NAME, METHOD_ONEARG_ARGS[0], METHOD_EXCEPTION); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectVoidWithNoArguments() throws Throwable { mockCallFactory.setExpectedCreateVoidStubCalls(1); mockCallFactory.setupCreateVoidStub(mockVoidStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_NOARG_NAME, C.NO_ARGS, mockVoidStub ); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher ); mockCallFactory.setupCreateCallOnceExpectation(mockCallOnceExpectation); mockCompositeCallable.addExpectedAddCallableValues(mockCallOnceExpectation); builder.expectVoid( METHOD_NOARG_NAME ); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectVoidWithOneArgument() throws Throwable { mockCallFactory.setExpectedCreateVoidStubCalls(1); mockCallFactory.setupCreateVoidStub(mockVoidStub); mockCallFactory.addExpectedCreateArgumentMatcherValues(METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS, mockVoidStub); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues(mockArgumentMatcher); mockCallFactory.setupCreateCallOnceExpectation(mockCallOnceExpectation); mockCompositeCallable.addExpectedAddCallableValues(mockCallOnceExpectation); builder.expectVoid(METHOD_ONEARG_NAME, METHOD_ONEARG_ARGS[0]); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectVoidWithOneConstraint() throws Throwable { mockCallFactory.setupCreateVoidStub(mockVoidStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS, mockVoidStub ); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation ); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation ); builder.expectVoid( METHOD_ONEARG_NAME, new IsEqual(METHOD_ONEARG_ARGS[0]) ); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectAndReturnWithManyConstraints() throws Throwable { mockCallFactory.addExpectedCreateReturnStubValues( METHOD_TWOARG_RESULT ); mockCallFactory.setupCreateReturnStub(mockReturnStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, mockReturnStub); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation); builder.expectAndReturn( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, METHOD_TWOARG_RESULT); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectAndThrowWithManyConstraints() throws Throwable { mockCallFactory.addExpectedCreateThrowStubValues(METHOD_EXCEPTION); mockCallFactory.setupCreateThrowStub(mockThrowStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, mockThrowStub ); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation); mockCompositeCallable.setupCallReturn(METHOD_TWOARG_RESULT); builder.expectAndThrow( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, METHOD_EXCEPTION ); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectAndReturnWithOneArgument() throws Throwable { mockCallFactory.addExpectedCreateReturnStubValues( METHOD_ONEARG_RESULT ); mockCallFactory.setupCreateReturnStub(mockReturnStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS, mockReturnStub ); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher ); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation ); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation ); mockCompositeCallable.setupCallReturn(METHOD_ONEARG_RESULT); builder.expectAndReturn( METHOD_ONEARG_NAME, METHOD_ONEARG_ARGS[0], METHOD_ONEARG_RESULT ); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectAndReturnWithOneConstraint() throws Throwable { mockCallFactory.addExpectedCreateReturnStubValues( METHOD_ONEARG_RESULT ); mockCallFactory.setupCreateReturnStub(mockReturnStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS, mockReturnStub ); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher ); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation ); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation ); mockCompositeCallable.setupCallReturn(METHOD_ONEARG_RESULT); builder.expectAndReturn( METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS[0], METHOD_ONEARG_RESULT ); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForExpectAndThrowWithOneConstraint() throws Throwable { mockCallFactory.addExpectedCreateReturnStubValues( METHOD_ONEARG_RESULT ); mockCallFactory.setupCreateThrowStub(mockThrowStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS, mockThrowStub ); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCallFactory.addExpectedCreateCallOnceExpectationValues( mockArgumentMatcher ); mockCallFactory.setupCreateCallOnceExpectation( mockCallOnceExpectation ); mockCompositeCallable.addExpectedAddCallableValues( mockCallOnceExpectation ); builder.expectAndThrow( METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS[0], METHOD_EXCEPTION ); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForMatchAndReturnWithManyConstraints() throws Throwable { mockCallFactory.addExpectedCreateReturnStubValues( METHOD_TWOARG_RESULT ); mockCallFactory.setupCreateReturnStub(mockReturnStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, mockReturnStub); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCompositeCallable.addExpectedAddCallableValues( mockArgumentMatcher); builder.matchAndReturn( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, METHOD_TWOARG_RESULT); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForMatchAndThrowWithNoArguments() throws Throwable { mockCallFactory.addExpectedCreateThrowStubValues(METHOD_EXCEPTION); mockCallFactory.setupCreateThrowStub(mockThrowStub); mockCallFactory.addExpectedCreateArgumentMatcherValues(METHOD_NOARG_NAME, C.NO_ARGS, mockThrowStub); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCompositeCallable.addExpectedAddCallableValues( mockArgumentMatcher); builder.matchAndThrow(METHOD_NOARG_NAME, METHOD_EXCEPTION); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForMatchAndThrowWithOneArgument() throws Throwable { mockCallFactory.addExpectedCreateThrowStubValues(METHOD_EXCEPTION); mockCallFactory.setupCreateThrowStub(mockThrowStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS, mockThrowStub); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCompositeCallable.addExpectedAddCallableValues( mockArgumentMatcher); builder.matchAndThrow( METHOD_ONEARG_NAME, METHOD_ONEARG_ARGS[0], METHOD_EXCEPTION); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForMatchAndThrowWithManyArguments() throws Throwable { mockCallFactory.addExpectedCreateThrowStubValues(METHOD_EXCEPTION); mockCallFactory.setupCreateThrowStub(mockThrowStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, mockThrowStub); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCompositeCallable.addExpectedAddCallableValues( mockArgumentMatcher); builder.matchAndThrow( METHOD_TWOARG_NAME, METHOD_TWOARG_CONSTRAINTS, METHOD_EXCEPTION ); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForMatchAndReturnWithOneArgument() throws Throwable { mockCallFactory.addExpectedCreateReturnStubValues( METHOD_ONEARG_RESULT); mockCallFactory.setupCreateReturnStub(mockReturnStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_ONEARG_NAME, METHOD_ONEARG_CONSTRAINTS, mockReturnStub); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCompositeCallable.addExpectedAddCallableValues( mockArgumentMatcher ); builder.matchAndReturn( METHOD_ONEARG_NAME, METHOD_ONEARG_ARGS[0], METHOD_ONEARG_RESULT ); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsDecoratorsForMatchAndReturnWithNoArguments() throws Throwable { mockCallFactory.addExpectedCreateReturnStubValues( METHOD_NOARGANDRETURN_RESULT); mockCallFactory.setupCreateReturnStub(mockReturnStub); mockCallFactory.addExpectedCreateArgumentMatcherValues( METHOD_NOARG_NAME, C.NO_ARGS, mockReturnStub); mockCallFactory.setupCreateArgumentMatcher(mockArgumentMatcher); mockCompositeCallable.addExpectedAddCallableValues( mockArgumentMatcher); builder.matchAndReturn( METHOD_NOARG_NAME, METHOD_NOARGANDRETURN_RESULT); Verifier.verifyObject(this); mockCompositeCallable.verifyExpectations(); } public void testBuildsCallSequenceAndWrapsItWithACallCollectionBuilder() { final CallCollectionBuilder expectedSequenceBuilder = new CallCollectionBuilder( mockCallFactory, mockCompositeCallable ); mockCallFactory.setupCreateCallSequence( mockCompositeCallable ); mockCallFactory.addExpectedCreateCallCollectionBuilderValues( mockCompositeCallable ); mockCallFactory.setupCreateCallCollectionBuilder( expectedSequenceBuilder ); CallCollectionBuilder returnedSequenceBuilder = builder.newCallSequence(); assertSame( "expected same builder for new sequence", expectedSequenceBuilder, returnedSequenceBuilder ); mockCallFactory.verify(); } public void testBuildsCallSelectionAndWrapsItWithACallCollectionBuilder() { final CallCollectionBuilder expectedSelectionBuilder = new CallCollectionBuilder( mockCallFactory, mockCompositeCallable ); mockCallFactory.setupCreateCallSelection( mockCompositeCallable ); mockCallFactory.addExpectedCreateCallCollectionBuilderValues( mockCompositeCallable ); mockCallFactory.setupCreateCallCollectionBuilder( expectedSelectionBuilder ); CallCollectionBuilder returnedSelectionBuilder = builder.newCallSelection(); assertSame( "expected same builder for new selection", expectedSelectionBuilder, returnedSelectionBuilder ); mockCallFactory.verify(); } } --- NEW FILE: MockCompositeCallable.java --- package test.mockobjects.dynamic; import com.mockobjects.ExceptionalReturnValue; import com.mockobjects.ExpectationCounter; import com.mockobjects.ExpectationList; import com.mockobjects.VoidReturnValues; import com.mockobjects.ReturnValues; import com.mockobjects.dynamic.Callable; import com.mockobjects.dynamic.CompositeCallable; public class MockCompositeCallable extends MockCallable implements CompositeCallable { private ExpectationCounter myAddCallableCalls = new ExpectationCounter("com.mockobjects.dynamic.CompositeCallable AddCallableCalls"); private ReturnValues myActualAddCallableReturnValues = new VoidReturnValues(false); private ExpectationList myAddCallableParameter0Values = new ExpectationList("com.mockobjects.dynamic.CompositeCallable com.mockobjects.dynamic.Callable"); private ExpectationCounter myResetCalls = new ExpectationCounter("com.mockobjects.dynamic.CompositeCallable ResetCalls"); private ReturnValues myActualResetReturnValues = new VoidReturnValues(false); public void setExpectedAddCallableCalls(int calls){ myAddCallableCalls.setExpected(calls); } public void addExpectedAddCallableValues(Callable arg0){ myAddCallableParameter0Values.addExpected(arg0); } public void addCallable(Callable arg0){ myAddCallableCalls.inc(); myAddCallableParameter0Values.addActual(arg0); Object nextReturnValue = myActualAddCallableReturnValues.getNext(); if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException) throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException(); } public void setupExceptionAddCallable(Throwable arg){ myActualAddCallableReturnValues.add(new ExceptionalReturnValue(arg)); } public void setExpectedResetCalls(int calls){ myResetCalls.setExpected(calls); } public void reset(){ myResetCalls.inc(); Object nextReturnValue = myActualResetReturnValues.getNext(); if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException) throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException(); } public void setupExceptionReset(Throwable arg){ myActualResetReturnValues.add(new ExceptionalReturnValue(arg)); } } Index: StubTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/StubTest.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- StubTest.java 12 Jun 2003 22:45:16 -0000 1.3 +++ StubTest.java 21 Jun 2003 14:01:07 -0000 1.3.2.1 @@ -3,15 +3,20 @@ */ package test.mockobjects.dynamic; -import com.mockobjects.dynamic.*; +import junit.framework.TestCase; -import junit.framework.*; +import com.mockobjects.dynamic.ActiveCall; +import com.mockobjects.dynamic.ReturnStub; +import com.mockobjects.dynamic.ThrowStub; +import com.mockobjects.dynamic.VoidStub; -/** - * @author dev - */ -public class StubTest extends TestCase { +public class StubTest + extends TestCase +{ + static final ActiveCall IGNORED_CALL = null; + + public StubTest(String name) { super(name); } @@ -20,25 +25,28 @@ final String result = "result"; ReturnStub stub = new ReturnStub(result); - String ignoredMethodName = "methodName"; - Object[] ignoredArgs = new Object[0]; - assertSame( "Should be the same result object", - result, stub.call( ignoredMethodName, ignoredArgs ) ); + assertSame( "should be the same result object", + result, stub.call( IGNORED_CALL ) ); } + public void testVoidStub() throws Throwable { + VoidStub stub = new VoidStub(); + + assertNull( "should return null", + stub.call( IGNORED_CALL ) ); + } + public void testThrowStub() { final Throwable throwable = new DummyThrowable(); ThrowStub stub = new ThrowStub(throwable); - String ignoredMethodName = "methodName"; - Object[] ignoredArgs = new Object[0]; try { - stub.call( ignoredMethodName, ignoredArgs ); + stub.call( IGNORED_CALL ); } catch( Throwable t ) { - assertSame( "Should be the same throwable", throwable, t ); + assertSame( "should be the same throwable", throwable, t ); } } } Index: MockConstraint.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/MockConstraint.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- MockConstraint.java 18 May 2003 20:59:39 -0000 1.2 +++ MockConstraint.java 21 Jun 2003 14:01:07 -0000 1.2.2.1 @@ -3,26 +3,28 @@ */ package test.mockobjects.dynamic; -import junit.framework.*; +import junit.framework.Assert; -import com.mockobjects.*; -import com.mockobjects.constraint.*; +import com.mockobjects.Verifiable; +import com.mockobjects.constraint.Constraint; -/** - * @author dev - */ -public class MockConstraint extends Assert implements Constraint, Verifiable { + +public class MockConstraint + extends Assert + implements Constraint, Verifiable +{ private String description; - private Object expectedArg; + private Object expectedArg; private boolean result; private boolean wasChecked = false; + public MockConstraint( String description, Object expectedArg, boolean result ) { this.description = description; this.expectedArg = expectedArg; this.result = result; } - + public String toString() { return description; } Index: DynamicUtilTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/DynamicUtilTest.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- DynamicUtilTest.java 18 May 2003 20:59:39 -0000 1.2 +++ DynamicUtilTest.java 21 Jun 2003 14:01:07 -0000 1.2.2.1 @@ -3,11 +3,11 @@ */ package test.mockobjects.dynamic; +import junit.framework.TestCase; + import com.mockobjects.dynamic.DynamicUtil; import com.mockobjects.dynamic.Mock; import com.mockobjects.util.AssertMo; - -import junit.framework.TestCase; /** * @author e2x Index: CallOnceExpectationTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/CallOnceExpectationTest.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- CallOnceExpectationTest.java 12 Jun 2003 22:45:16 -0000 1.2 +++ CallOnceExpectationTest.java 21 Jun 2003 14:01:07 -0000 1.2.2.1 @@ -1,19 +1,25 @@ package test.mockobjects.dynamic; -import com.mockobjects.dynamic.*; -import com.mockobjects.util.*; +import junit.framework.AssertionFailedError; +import junit.framework.TestCase; -import junit.framework.*; +import com.mockobjects.dynamic.ActiveCall; +import com.mockobjects.dynamic.CallOnceExpectation; +import com.mockobjects.dynamic.DynamicUtil; +import com.mockobjects.util.AssertMo; -public class CallOnceExpectationTest extends TestCase { - +public class CallOnceExpectationTest + extends TestCase +{ final String RESULT = "result!"; final String METHOD_NAME = "methodName"; final Object[] ARGS = { "arg1", "arg2" }; final String DECORATED_DESCRIPTION = DynamicUtil.methodToString( METHOD_NAME, ARGS ); - - Mock ignoredMock = null; + final ActiveCall CALL = new ActiveCall( + METHOD_NAME, new Class[]{String.class,String.class}, String.class, + ARGS ); + MockCallable mockCallable = new MockCallable(); CallOnceExpectation call = new CallOnceExpectation( mockCallable ); @@ -49,24 +55,24 @@ mockCallable.setupCallReturn( RESULT ); mockCallable.setExpectedVerifyCalls(1); - call.call( METHOD_NAME, ARGS ); + call.call( CALL ); call.verify(); mockCallable.verifyExpectations(); } public void testMatchesDelegated() throws Throwable { - mockCallable.setExpectedMatches( METHOD_NAME, ARGS ); + mockCallable.setExpectedMatches(CALL); mockCallable.setupMatchesReturn(true); - assertTrue( "returns matches to be true", call.matches( METHOD_NAME, ARGS ) ); + assertTrue( "returns matches to be true", call.matches(CALL) ); mockCallable.verifyExpectations(); } public void testCallArgumentsPassedThrough() throws Throwable { - mockCallable.setExpectedCall(ignoredMock, METHOD_NAME, ARGS); + mockCallable.setExpectedCall(CALL); mockCallable.setupCallReturn(RESULT); - call.call( METHOD_NAME, ARGS ); + call.call( CALL ); mockCallable.verifyExpectations(); } @@ -75,16 +81,16 @@ mockCallable.setupMatchesReturn(true); mockCallable.setupCallReturn(RESULT); - assertTrue( "First time should match", call.matches(METHOD_NAME, ARGS)); - call.call(METHOD_NAME, ARGS); - assertFalse( "Second time should not match", call.matches(METHOD_NAME, ARGS)); + assertTrue( "First time should match", call.matches(CALL)); + call.call(CALL); + assertFalse( "Second time should not match", call.matches(CALL)); } public void testDecoratedResultPassedThrough() throws Throwable { mockCallable.setupCallReturn(RESULT); assertSame( "should return decorated's result", - RESULT, call.call( METHOD_NAME, ARGS ) ); + RESULT, call.call(CALL) ); mockCallable.verifyExpectations(); } @@ -95,7 +101,7 @@ mockCallable.setupCallThrow(exception); try { - call.call( METHOD_NAME, ARGS ); + call.call(CALL); fail("expected decorated's throwable to be thrown"); } catch( DummyThrowable ex ) { Index: MockCallable.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/MockCallable.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- MockCallable.java 12 Jun 2003 22:45:16 -0000 1.3 +++ MockCallable.java 21 Jun 2003 14:01:07 -0000 1.3.2.1 @@ -1,22 +1,22 @@ package test.mockobjects.dynamic; -import junit.framework.*; +import junit.framework.AssertionFailedError; -import com.mockobjects.*; +import com.mockobjects.ExpectationCounter; +import com.mockobjects.ExpectationValue; +import com.mockobjects.ReturnValue; +import com.mockobjects.dynamic.ActiveCall; import com.mockobjects.dynamic.Callable; -import com.mockobjects.dynamic.Mock; -import com.mockobjects.util.*; +import com.mockobjects.util.Verifier; public class MockCallable implements Callable { private ExpectationCounter callCount = new ExpectationCounter("call.count"); - private ExpectationValue callMethodName = new ExpectationValue("call.methodName"); - private ExpectationList callArgs = new ExpectationList("call.args"); + private ExpectationValue callCall = new ExpectationValue("call.call"); private ReturnValue callResult = new ReturnValue("call.return"); private Throwable callThrow = null; - private ExpectationValue matchesMethodName = new ExpectationValue("matches.methodName"); - private ExpectationList matchesArgs = new ExpectationList("matches.args"); + private ExpectationValue matchesCall = new ExpectationValue("matches.call"); private ReturnValue matchesResult = new ReturnValue("matches.return"); private ExpectationCounter matchesCount = new ExpectationCounter("matches.count"); @@ -30,9 +30,8 @@ callCount.setExpected(count); } - public void setExpectedCall( Mock mock, String methodName, Object[] args ) { - callMethodName.setExpected(methodName); - callArgs.addExpectedMany(args); + public void setExpectedCall( ActiveCall call ) { + callCall.setExpected(call); } public void setupCallReturn( Object result ) { @@ -43,9 +42,8 @@ callThrow = thrown; } - public Object call(String methodName, Object[] args) throws Throwable { - callMethodName.setActual(methodName); - callArgs.addActualMany(args); + public Object call( ActiveCall call ) throws Throwable { + callCall.setActual(call); callCount.inc(); if( callThrow != null ) { @@ -55,9 +53,8 @@ } } - public void setExpectedMatches( String methodName, Object[] args ) { - matchesMethodName.setExpected(methodName); - matchesArgs.addExpectedMany(args); + public void setExpectedMatches( ActiveCall call )... [truncated message content] |
From: Steve F. <sm...@us...> - 2003-06-21 14:00:11
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/tools In directory sc8-pr-cvs1:/tmp/cvs-serv11437/src/core/com/mockobjects/tools Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/tools added to the repository --> Using per-directory sticky tag `Nat_reworks_dynamics_from_0_09' |
From: Steve F. <st...@m3...> - 2003-06-21 13:19:41
|
The trick is in setting the project path to the source code. If you just want the core, then only include that in your project. If you include everything, then /something/ is guaranteed to be broken because of the multiple VM versions. If you want JDK stuff, then include JDK/(common + your version). If you want J2EE stuff, then import j2ee.jar and include j2ee/(common + your version). This is a problem to do with coping with different versions combined with an IDE. Eclipse isn't the only java tool in the world (although sometimes it feels like it is). Documentation would be a good idea. Also, splitting the project (e.g. splitting out the alt packages). Right now, I think we have a good case for retiring some of the libraries, such as SQL, which are based on interfaces but we'd have to prepare that with the community. If you really want to fix it, maybe you could write a control panel that manages the configuration of a mock object eclipse project ;-) S. Tim Mackinnon wrote: > Can I get a definite list of what I should load up in an eclipse project to > have no errors in the Mock Objects project...? > > Its very frustrating and very confusing - am I supposed load J2EE 1.3 and > 1.4 and Common? But then there are errors with this. Similarly there are > examples like mailing list and calcserver that are always broken? > > How is anyone supposed to load this stuff up make sense of it? > > To be honest I am really thinking we should just separate dynamock out of > this stuff and have a nice simple thing that people can load up error free. > But in the meantime if we can sort out this grunge we can at least doucment > it on the project wiki. > > Tim > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Tim M. <tim...@po...> - 2003-06-21 11:07:43
|
Can I get a definite list of what I should load up in an eclipse project to have no errors in the Mock Objects project...? Its very frustrating and very confusing - am I supposed load J2EE 1.3 and 1.4 and Common? But then there are errors with this. Similarly there are examples like mailing list and calcserver that are always broken? How is anyone supposed to load this stuff up make sense of it? To be honest I am really thinking we should just separate dynamock out of this stuff and have a nice simple thing that people can load up error free. But in the meantime if we can sort out this grunge we can at least doucment it on the project wiki. Tim --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 |
From: Nat P. <nat...@b1...> - 2003-06-20 00:42:47
|
I've written a tool that automatically generates all overloaded methods for primitive types (i.e. it implements "autoboxing" in JDK's 1.4 and below. Using the tool it is easy to add methods that set up different expectations: expectOneOrMoreAndReturn, matchNameAndReturn, etc. Cheers, Nat. _______________________ Dr. Nathaniel Pryce B13media Ltd. http://www.b13media.com +44 (0)7712 526 661 ----- Original Message ----- From: "Tim Mackinnon" <tim...@po...> To: "Barry Kaplan" <bk...@in...> Cc: "Mockobjects-Java-Dev" <moc...@li...> Sent: Friday, June 20, 2003 12:46 AM Subject: RE: [MO-java-dev] factorying calls on a per method basis? > We've been thinking about your problem... its an interesting one, which has > actually been quite rare over 4 years of development... but it seems a > reasonable request.../ > > anyway, I'm thinking that maybe match signatures should allow this level of > customization eg. > > myMock.expectAndReturn(OneOrMore.eq("getSomething", 12)) > > vs. > > myMock.expectAndReturn(One.eq("getSomething", 13)). > > that is, the signature specifice the cardinality. > > Some of the other guys have also been thinking of: > > myMock.matchAndReturn(WildCardOne("get*", null))); > myMock.expectAndReturn(One("getLenght", 12))); > > e.g. all geters will return null, but expect only one call the length which > will return 12. > > > In retrospect after all of the refactoring, having method signatures as an > oblect gives a possible the sweet spot that gives lots of interesting > behavior? > > Tim > > > -----Original Message----- > > From: moc...@li... > > [mailto:moc...@li...]On Behalf Of > > Barry Kaplan > > Sent: 19 June 2003 17:24 > > To: mockobjects > > Subject: [MO-java-dev] factorying calls on a per method basis? > > > > > > Often I find the need for a method to be called at least once, but its > > ok if its called more times. Generally this is with a getter that is > > providing a property used for some external purpose. What I end > > up doing is: > > > > myMock.expectAndReturn("getSomething", 12); > > myMock.matchAndReturn("getSomething", 12); > > > > While this works just fine, it gets to be a bit verbose at times. > > > > I know I can override the callable created by the 'expectAndReturn' > > method by creating the mock with a custom factory. But the that factory > > applies to all invocations of 'expect*'. What I would like is the > > ability to define custom callables on a per-method basis. I guess like > > the previous version allowed. > > > > Would it be so bad to have?: > > > > Mock.expectAndReturn(Callable callable) > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: INetU > > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > --- > > Incoming mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Tim M. <tim...@po...> - 2003-06-19 23:41:49
|
We've been thinking about your problem... its an interesting one, which has actually been quite rare over 4 years of development... but it seems a reasonable request.../ anyway, I'm thinking that maybe match signatures should allow this level of customization eg. myMock.expectAndReturn(OneOrMore.eq("getSomething", 12)) vs. myMock.expectAndReturn(One.eq("getSomething", 13)). that is, the signature specifice the cardinality. Some of the other guys have also been thinking of: myMock.matchAndReturn(WildCardOne("get*", null))); myMock.expectAndReturn(One("getLenght", 12))); e.g. all geters will return null, but expect only one call the length which will return 12. In retrospect after all of the refactoring, having method signatures as an oblect gives a possible the sweet spot that gives lots of interesting behavior? Tim > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...]On Behalf Of > Barry Kaplan > Sent: 19 June 2003 17:24 > To: mockobjects > Subject: [MO-java-dev] factorying calls on a per method basis? > > > Often I find the need for a method to be called at least once, but its > ok if its called more times. Generally this is with a getter that is > providing a property used for some external purpose. What I end > up doing is: > > myMock.expectAndReturn("getSomething", 12); > myMock.matchAndReturn("getSomething", 12); > > While this works just fine, it gets to be a bit verbose at times. > > I know I can override the callable created by the 'expectAndReturn' > method by creating the mock with a custom factory. But the that factory > applies to all invocations of 'expect*'. What I would like is the > ability to define custom callables on a per-method basis. I guess like > the previous version allowed. > > Would it be so bad to have?: > > Mock.expectAndReturn(Callable callable) > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 |
From: Nat P. <nat...@b1...> - 2003-06-19 17:49:56
|
The Mock class has the method add( Callable callable ) that adds a custom callable object to the mock. The argument can be a user defined implementation of the Callable interface, a chain of decorators built by the user or a combination of the two. The expect... and match... methods are implemented in terms of the add method. There should be no need to change the CallFactory implementation used by the mock. Cheers, Nat. _______________________ Dr. Nathaniel Pryce B13media Ltd. http://www.b13media.com +44 (0)7712 526 661 ----- Original Message ----- From: "Barry Kaplan" <bk...@in...> To: "mockobjects" <moc...@li...> Sent: Thursday, June 19, 2003 5:23 PM Subject: [MO-java-dev] factorying calls on a per method basis? > Often I find the need for a method to be called at least once, but its > ok if its called more times. Generally this is with a getter that is > providing a property used for some external purpose. What I end up doing is: > > myMock.expectAndReturn("getSomething", 12); > myMock.matchAndReturn("getSomething", 12); > > While this works just fine, it gets to be a bit verbose at times. > > I know I can override the callable created by the 'expectAndReturn' > method by creating the mock with a custom factory. But the that factory > applies to all invocations of 'expect*'. What I would like is the > ability to define custom callables on a per-method basis. I guess like > the previous version allowed. > > Would it be so bad to have?: > > Mock.expectAndReturn(Callable callable) > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Barry K. <bk...@in...> - 2003-06-19 16:22:32
|
Often I find the need for a method to be called at least once, but its ok if its called more times. Generally this is with a getter that is providing a property used for some external purpose. What I end up doing is: myMock.expectAndReturn("getSomething", 12); myMock.matchAndReturn("getSomething", 12); While this works just fine, it gets to be a bit verbose at times. I know I can override the callable created by the 'expectAndReturn' method by creating the mock with a custom factory. But the that factory applies to all invocations of 'expect*'. What I would like is the ability to define custom callables on a per-method basis. I guess like the previous version allowed. Would it be so bad to have?: Mock.expectAndReturn(Callable callable) |
From: Jeff M. <jef...@mk...> - 2003-06-19 08:47:31
|
HTTPClient is a totally interface free area, hence the need to an alt API. On Wed, 2003-06-18 at 23:17, Tim Mackinnon wrote: > Would it make sense to pull the commons bit for the moment then? >=20 > Have you considered using the dynamic stuff for these rarer libraries, or= is > it not possible due to final and interface free classes? >=20 > Tim >=20 > > -----Original Message----- > > From: moc...@li... > > [mailto:moc...@li...]On Behalf Of > > Jeff Martin > > Sent: 18 June 2003 14:37 > > To: MockObjects > > Subject: Re: [MO-java-dev] Httpclient Extension question > > > > > > Go for it it's been something I've been meaning to do for a while, but > > not got around to it. Think I'm probably the only person using it > > anyway. > > > > On Wed, 2003-06-18 at 13:10, Paul Nasrat wrote: > > > Apologies for wrapping. > > > > > > I'm compiling with jakarta-commons-httpclient-2.0-2.beta1.1jpp. > > > > > > CLASSPATH=3D/usr/share/java/jakarta-commons-httpclient.jar \ > > > ant jar-ext-httpclient > > > > > > compile-ext-httpclient: > > > [mkdir] Created dir: > > > /local/home/paul/rpm/BUILD/mockobjects-0.09/out/ext/httpclient/classe= s > > > [javac] Compiling 13 source files to > > > /local/home/paul/rpm/BUILD/mockobjects-0.09/out/ext/httpclient/classe= s > > > [javac] > > > > > /local/home/paul/rpm/BUILD/mockobjects-0.09/src/extensions/com/moc > kobjects/apache/commons/httpclient/MockHttpMethod.java:10: > > > com.mockobjects.apache.commons.httpclient.MockHttpMethod should be > > > declared abstract; it does not define getHostConfiguration() in > > > com.mockobjects.apache.commons.httpclient.MockHttpMethod > > > [javac] public class MockHttpMethod extends MockMethodHelper > > > implements HttpMethod { > > > [javac] ^ > > > [javac] Note: Some input files use or override a deprecated API. > > > [javac] Note: Recompile with -deprecation for details. > > > [javac] 1 error > > > > > > This looks like a signature change in commons-httpclient, what versio= n > > > have people been building against. The patch is trivial but I'm not > > > sure if it should be submitted. > > > > > > Paul > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: INetU > > > Attention Web Developers & Consultants: Become An INetU Hosting Partn= er. > > > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commissi= on! > > > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.ph= p > > > _______________________________________________ > > > Mockobjects-java-dev mailing list > > > Moc...@li... > > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > -- > > > > jeff martin > > information technologist > > mkodo limited > > > > mobile: 44 (0) 78 55 478 331 > > phone: 44 (0) 20 77 29 45 45 > > email: jef...@mk... > > > > www.mkodo.com > > > > 73 Leonard St, London, EC2A 4QS. U.K > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev --=20 jeff martin information technologist mkodo limited mobile: 44 (0) 78 55 478 331 phone: 44 (0) 20 77 29 45 45 email: jef...@mk... www.mkodo.com 73 Leonard St, London, EC2A 4QS. U.K |
From: Paul N. <pa...@tr...> - 2003-06-19 08:36:38
|
On Wed, Jun 18, 2003 at 11:17:14PM +0100, Tim Mackinnon wrote: > Would it make sense to pull the commons bit for the moment then? As it's in 0.09 I'd say keep it in with a fix for a minor release (so I can package based on an upstream release) then pull at your option. Hopefully making it easy to install through jpackage will increase coverage :) Paul |
From: Nat P. <nat...@b1...> - 2003-06-19 08:25:46
|
From: "Eli Tucker" <sou...@ne...> > Are DynaMocks for use only with interfaces? If so, it sure would be > nice to have a DynaInterface that is generated on the fly from a class. At the moment yes, because of limitations of the java.lang.reflect.Proxy class. Generating mocks that extend real classes causes a number of tricky issues. For example, what should mocks pass as arguments to constructors of the base class? What if the constructor of the base class does "real" work, that you don't want to happen at test time? Automatically generating an interface from a class would not work because the mock must be interchangeable with the class to be mocked at compile time. So, if you want to mock an existing class I would recommend changing the design of that class so that it follows interface/implementation separation and then using the dynamic mocks. If you don't want to do that, you can write a mock by hand using the core com.mockobjects classes. > Also, is there any more information about DynaMocks available besides > what is shown on the wiki at these locations? > > http://www.mockobjects.com/wiki/SimpleServletTest > http://www.mockobjects.com/wiki/DynamicMockObjects There are also the unit tests in the test.mockobjects.dynamic package. On the wiki, you can also read: http://www.mockobjects.com/wiki/InterestingThreadsFromTheMailingLists Cheers, Nat. _______________________ Dr. Nathaniel Pryce B13media Ltd. http://www.b13media.com +44 (0)7712 526 661 |
From: Eli T. <sou...@ne...> - 2003-06-19 00:56:14
|
Are DynaMocks for use only with interfaces? If so, it sure would be nice to have a DynaInterface that is generated on the fly from a class. Also, is there any more information about DynaMocks available besides what is shown on the wiki at these locations? http://www.mockobjects.com/wiki/SimpleServletTest http://www.mockobjects.com/wiki/DynamicMockObjects Thanks, - Eli http://nerdmonkey.com |
From: Tim M. <tim...@po...> - 2003-06-18 22:12:59
|
Would it make sense to pull the commons bit for the moment then? Have you considered using the dynamic stuff for these rarer libraries, or is it not possible due to final and interface free classes? Tim > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...]On Behalf Of > Jeff Martin > Sent: 18 June 2003 14:37 > To: MockObjects > Subject: Re: [MO-java-dev] Httpclient Extension question > > > Go for it it's been something I've been meaning to do for a while, but > not got around to it. Think I'm probably the only person using it > anyway. > > On Wed, 2003-06-18 at 13:10, Paul Nasrat wrote: > > Apologies for wrapping. > > > > I'm compiling with jakarta-commons-httpclient-2.0-2.beta1.1jpp. > > > > CLASSPATH=/usr/share/java/jakarta-commons-httpclient.jar \ > > ant jar-ext-httpclient > > > > compile-ext-httpclient: > > [mkdir] Created dir: > > /local/home/paul/rpm/BUILD/mockobjects-0.09/out/ext/httpclient/classes > > [javac] Compiling 13 source files to > > /local/home/paul/rpm/BUILD/mockobjects-0.09/out/ext/httpclient/classes > > [javac] > > > /local/home/paul/rpm/BUILD/mockobjects-0.09/src/extensions/com/moc kobjects/apache/commons/httpclient/MockHttpMethod.java:10: > > com.mockobjects.apache.commons.httpclient.MockHttpMethod should be > > declared abstract; it does not define getHostConfiguration() in > > com.mockobjects.apache.commons.httpclient.MockHttpMethod > > [javac] public class MockHttpMethod extends MockMethodHelper > > implements HttpMethod { > > [javac] ^ > > [javac] Note: Some input files use or override a deprecated API. > > [javac] Note: Recompile with -deprecation for details. > > [javac] 1 error > > > > This looks like a signature change in commons-httpclient, what version > > have people been building against. The patch is trivial but I'm not > > sure if it should be submitted. > > > > Paul > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: INetU > > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > -- > > jeff martin > information technologist > mkodo limited > > mobile: 44 (0) 78 55 478 331 > phone: 44 (0) 20 77 29 45 45 > email: jef...@mk... > > www.mkodo.com > > 73 Leonard St, London, EC2A 4QS. U.K > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003 |
From: Paul N. <pa...@tr...> - 2003-06-18 14:02:34
|
On Wed, Jun 18, 2003 at 02:37:12PM +0100, Jeff Martin wrote: > Go for it it's been something I've been meaning to do for a while, but > not got around to it. Think I'm probably the only person using it > anyway. Well, I can build it - but any chance you have a simple test I can run to check I haven't broken anything :) Next I'm going to look at modularising the test targets, as I don't think I can do the j2ee stuff yet. Thanks for the speedy commit btw. Paul |
From: Jeff M. <jef...@mk...> - 2003-06-18 13:35:49
|
Go for it it's been something I've been meaning to do for a while, but not got around to it. Think I'm probably the only person using it anyway. On Wed, 2003-06-18 at 13:10, Paul Nasrat wrote: > Apologies for wrapping. >=20 > I'm compiling with jakarta-commons-httpclient-2.0-2.beta1.1jpp. >=20 > CLASSPATH=3D/usr/share/java/jakarta-commons-httpclient.jar \ > ant jar-ext-httpclient >=20 > compile-ext-httpclient: > [mkdir] Created dir: > /local/home/paul/rpm/BUILD/mockobjects-0.09/out/ext/httpclient/classes > [javac] Compiling 13 source files to > /local/home/paul/rpm/BUILD/mockobjects-0.09/out/ext/httpclient/classes > [javac] > /local/home/paul/rpm/BUILD/mockobjects-0.09/src/extensions/com/mockobject= s/apache/commons/httpclient/MockHttpMethod.java:10: > com.mockobjects.apache.commons.httpclient.MockHttpMethod should be > declared abstract; it does not define getHostConfiguration() in > com.mockobjects.apache.commons.httpclient.MockHttpMethod > [javac] public class MockHttpMethod extends MockMethodHelper > implements HttpMethod { > [javac] ^ > [javac] Note: Some input files use or override a deprecated API. > [javac] Note: Recompile with -deprecation for details. > [javac] 1 error >=20 > This looks like a signature change in commons-httpclient, what version > have people been building against. The patch is trivial but I'm not > sure if it should be submitted. >=20 > Paul >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev --=20 jeff martin information technologist mkodo limited mobile: 44 (0) 78 55 478 331 phone: 44 (0) 20 77 29 45 45 email: jef...@mk... www.mkodo.com 73 Leonard St, London, EC2A 4QS. U.K |
From: Paul N. <pa...@tr...> - 2003-06-18 12:13:12
|
Apologies for wrapping. I'm compiling with jakarta-commons-httpclient-2.0-2.beta1.1jpp. CLASSPATH=/usr/share/java/jakarta-commons-httpclient.jar \ ant jar-ext-httpclient compile-ext-httpclient: [mkdir] Created dir: /local/home/paul/rpm/BUILD/mockobjects-0.09/out/ext/httpclient/classes [javac] Compiling 13 source files to /local/home/paul/rpm/BUILD/mockobjects-0.09/out/ext/httpclient/classes [javac] /local/home/paul/rpm/BUILD/mockobjects-0.09/src/extensions/com/mockobjects/apache/commons/httpclient/MockHttpMethod.java:10: com.mockobjects.apache.commons.httpclient.MockHttpMethod should be declared abstract; it does not define getHostConfiguration() in com.mockobjects.apache.commons.httpclient.MockHttpMethod [javac] public class MockHttpMethod extends MockMethodHelper implements HttpMethod { [javac] ^ [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -deprecation for details. [javac] 1 error This looks like a signature change in commons-httpclient, what version have people been building against. The patch is trivial but I'm not sure if it should be submitted. Paul |
From: Jeff M. <cus...@us...> - 2003-06-18 10:30:05
|
Update of /cvsroot/mockobjects/mockobjects-java In directory sc8-pr-cvs1:/tmp/cvs-serv31059 Modified Files: build.xml Log Message: Make jdk jar target depend on jdk compile (Paul Nasrat) Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- build.xml 3 Jun 2003 07:30:10 -0000 1.38 +++ build.xml 18 Jun 2003 10:30:01 -0000 1.39 @@ -248,7 +248,7 @@ </target> <target name="jar-jdk" - depends="deliverable-names" + depends="compile-jdk, deliverable-names" description="Generate jdk mockobjects jar"> <antcall target="_inner-jar"> <param name="jarfile.name" |
From: Paul N. <pa...@tr...> - 2003-06-18 10:18:01
|
OK, this is what I'm aiming at. I'm going to package up MO for jpackage, and I want to do this modularly. I build mockobjects-core which works fine (target jar-core) I then want to build jar-jdk target against 1.3.x and 1.4.x JDK's. This doesn't work out of the box - I attach a patch (release often and all that). I'm working against the tagged release and sf.net's pserver is being painfull. More to come :) Cheers Paul |
From: Nat P. <nat...@b1...> - 2003-06-14 16:08:29
|
From: "Tim Mackinnon" <tim...@po...> > I recall telling [Vincent] to rename the method to resetAllMatchesAndExpectations > and not use any javacdoc but he couldn't be bothered and I was tired at the > time. How about renaming it to "removeAllElements" (to be very explicit) or "clear" (to match the Java collections API)? Cheers, Nat. _______________________ Dr. Nathaniel Pryce B13media Ltd. http://www.b13media.com +44 (0)7712 526 661 _______________________ Dr. Nathaniel Pryce B13media Ltd. http://www.b13media.com +44 (0)7712 526 661 |
From: Steve F. <sm...@us...> - 2003-06-12 22:45:23
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv21757/src/core/test/mockobjects/dynamic Modified Files: CallMatchTest.java MockCallableAddable.java CallSequenceTest.java CallBagTest.java CallOnceExpectationTest.java StubTest.java MockCallable.java MockTest.java Log Message: Removed 'mock' parameter from Callable.call() Fixed up some of the field names in the mocks for testing dynamic mocks Index: CallMatchTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/CallMatchTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CallMatchTest.java 19 May 2003 23:37:49 -0000 1.3 +++ CallMatchTest.java 12 Jun 2003 22:45:15 -0000 1.4 @@ -28,7 +28,7 @@ mockCallable.setExpectedCall(mock, METHOD_NAME, arguments); mockCallable.setupCallReturn(result); - callSignature.call(mock, METHOD_NAME, arguments); + callSignature.call(METHOD_NAME, arguments); mockCallable.verifyExpectations(); } @@ -45,7 +45,7 @@ mockCallable.setExpectedVerifyCalls(1); mockCallable.setupCallReturn("result"); - callSignature.call(mock, "methodName", IGNORED_ARGS); + callSignature.call("methodName", IGNORED_ARGS); callSignature.verify(); mockCallable.verifyExpectations(); @@ -54,8 +54,8 @@ public void testMultipleCallsSucceed() throws Throwable { mockCallable.setupCallReturn("result"); - callSignature.call(mock, METHOD_NAME, IGNORED_ARGS); - callSignature.call(mock, METHOD_NAME, IGNORED_ARGS); + callSignature.call(METHOD_NAME, IGNORED_ARGS); + callSignature.call(METHOD_NAME, IGNORED_ARGS); mockCallable.verifyExpectations(); } @@ -75,9 +75,9 @@ mockConstraintMatcher.setupMatches(true); - callSignature.call(mock, METHOD_NAME, IGNORED_ARGS); + callSignature.call(METHOD_NAME, IGNORED_ARGS); assertTrue("matches after first call", callSignature.matches(METHOD_NAME, IGNORED_ARGS)); - callSignature.call(mock, METHOD_NAME, IGNORED_ARGS); + callSignature.call(METHOD_NAME, IGNORED_ARGS); assertTrue("matches after further calls", callSignature.matches(METHOD_NAME, IGNORED_ARGS)); mockCallable.verifyExpectations(); Index: MockCallableAddable.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/MockCallableAddable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MockCallableAddable.java 18 May 2003 20:59:38 -0000 1.2 +++ MockCallableAddable.java 12 Jun 2003 22:45:15 -0000 1.3 @@ -1,10 +1,11 @@ package test.mockobjects.dynamic; -import com.mockobjects.*; - +import com.mockobjects.ExpectationCounter; +import com.mockobjects.ExpectationList; +import com.mockobjects.MockObject; +import com.mockobjects.ReturnValues; import com.mockobjects.dynamic.Callable; import com.mockobjects.dynamic.CallableAddable; -import com.mockobjects.dynamic.Mock; import com.mockobjects.util.NotImplementedException; //Mock modified for []args @@ -21,9 +22,8 @@ private ReturnValues myActualGetDescriptionReturnValues = new ReturnValues(true); private ExpectationCounter myCallCalls = new ExpectationCounter("com.mockobjects.dynamic.CallableAddable CallCalls"); private ReturnValues myActualCallReturnValues = new ReturnValues(true); - private ExpectationList myCallParameter0Values = new ExpectationList("com.mockobjects.dynamic.CallableAddable CallParameter0Values"); - private ExpectationList myCallParameter1Values = new ExpectationList("com.mockobjects.dynamic.CallableAddable CallParameter1Values"); - private ExpectationList myCallParameter2Values = new ExpectationList("com.mockobjects.dynamic.CallableAddable CallParameter2Values"); + private ExpectationList myCallMethodNames = new ExpectationList("com.mockobjects.dynamic.CallableAddable methodName"); + private ExpectationList myCallArguments = new ExpectationList("com.mockobjects.dynamic.CallableAddable arguments"); private ExpectationCounter myVerifyCalls = new ExpectationCounter("com.mockobjects.dynamic.CallableAddable VerifyCalls"); public void reset() { @@ -99,18 +99,16 @@ myCallCalls.setExpected(calls); } - public void addExpectedCall(Mock arg0, String arg1, Object[] arg2) { - myCallParameter0Values.addExpected(arg0); - myCallParameter1Values.addExpected(arg1); - myCallParameter2Values.addExpectedMany(arg2); + public void addExpectedCall(String methodName, Object[] args) { + myCallMethodNames.addExpected(methodName); + myCallArguments.addExpectedMany(args); } - public Object call(Mock arg0, String arg1, Object[] arg2) + public Object call(String methodName, Object[] args) throws Throwable { myCallCalls.inc(); - myCallParameter0Values.addActual(arg0); - myCallParameter1Values.addActual(arg1); - myCallParameter2Values.addActualMany(arg2); + myCallMethodNames.addActual(methodName); + myCallArguments.addActualMany(args); Object nextReturnValue = myActualCallReturnValues.getNext(); @@ -140,9 +138,8 @@ myMatchesParameter1Values.verify(); myGetDescriptionCalls.verify(); myCallCalls.verify(); - myCallParameter0Values.verify(); - myCallParameter1Values.verify(); - myCallParameter2Values.verify(); + myCallMethodNames.verify(); + myCallArguments.verify(); myVerifyCalls.verify(); } } Index: CallSequenceTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/CallSequenceTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- CallSequenceTest.java 20 May 2003 00:05:24 -0000 1.8 +++ CallSequenceTest.java 12 Jun 2003 22:45:16 -0000 1.9 @@ -46,7 +46,7 @@ callSequence.addExpect(mockCallable); try { - callSequence.call(unusedMock, "hello", new String[0]); + callSequence.call("hello", new String[0]); } catch (Throwable ex) { assertSame("exception is caught by mock", throwable, ex); } @@ -54,7 +54,7 @@ public void testCallFailsOnEmptyList() throws Throwable { try { - callSequence.call(unusedMock, "missingMethod", new Object[0]); + callSequence.call("missingMethod", new Object[0]); } catch (AssertionFailedError ex) { AssertMo.assertIncludes("reports empty set in error message", "no methods", ex.getMessage()); @@ -68,10 +68,10 @@ mockCallable.setupMatchesReturn(true); mockCallable.setupCallReturn(METHOD_A_RESULT); callSequence.addExpect(mockCallable); - callSequence.call(unusedMock, "willdefinitelyMatch", new Object[0]); + callSequence.call("willdefinitelyMatch", new Object[0]); try { - callSequence.call(unusedMock, "oneMethodTooMany", new Object[0]); + callSequence.call("oneMethodTooMany", new Object[0]); } catch (AssertionFailedError ex) { AssertMo.assertIncludes("reports one method call too many", "too many", ex.getMessage()); @@ -92,7 +92,7 @@ callSequence.addExpect(methodA); callSequence.addExpect(methodB); - assertSame("expected result from method A", METHOD_A_RESULT, callSequence.call(unusedMock, METHOD_A_NAME, METHOD_A_ARGS)); + assertSame("expected result from method A", METHOD_A_RESULT, callSequence.call(METHOD_A_NAME, METHOD_A_ARGS)); methodA.verifyExpectations(); methodB.verifyExpectations(); @@ -109,7 +109,7 @@ callSequence.addExpect(methodB); try { - assertSame("expected result from method B", METHOD_B_RESULT, callSequence.call(unusedMock, METHOD_B_NAME, METHOD_B_ARGS)); + assertSame("expected result from method B", METHOD_B_RESULT, callSequence.call(METHOD_B_NAME, METHOD_B_ARGS)); } catch (AssertionFailedError ex) { String message = ex.getMessage(); AssertMo.assertIncludes("Should have expected error message", "Unexpected call: methodB", message); @@ -135,7 +135,7 @@ callSequence.addExpect(mockCallable); - assertSame("result is returned by mock", result, callSequence.call(unusedMock, "method", new Object[0])); + assertSame("result is returned by mock", result, callSequence.call("method", new Object[0])); } public void testEmptySetVerifies() throws Exception { @@ -159,7 +159,7 @@ callSequence.addExpect(methodB); try { - callSequence.call(unusedMock, methodCName, methodCArgs); + callSequence.call(methodCName, methodCArgs); } catch (AssertionFailedError ex) { AssertMo.assertIncludes("method name is in error message", "methodC", ex.getMessage()); AssertMo.assertIncludes("argument is in error message (1)", methodCArgs[0], ex.getMessage()); @@ -213,6 +213,6 @@ callSequence.addExpect(new CallOnceExpectation(anotherMethodASignature)); assertSame("expected result from method B, as expect has precendence over match", "result2", - callSequence.call(unusedMock, METHOD_A_NAME, METHOD_A_ARGS)); + callSequence.call(METHOD_A_NAME, METHOD_A_ARGS)); } } Index: CallBagTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/CallBagTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CallBagTest.java 20 May 2003 00:05:24 -0000 1.4 +++ CallBagTest.java 12 Jun 2003 22:45:16 -0000 1.5 @@ -29,7 +29,7 @@ public void testCallFailsOnEmptySet() throws Throwable { try { - callSet.call(unusedMock, "missingMethod", new Object[0]); + callSet.call("missingMethod", new Object[0]); } catch (AssertionFailedError ex) { AssertMo.assertIncludes("reports empty set in error message", "no methods", ex.getMessage()); @@ -51,7 +51,7 @@ callSet.addExpect(methodB); assertSame("expected result from method A", METHOD_A_RESULT, - callSet.call(unusedMock, METHOD_A_NAME, METHOD_A_ARGS)); + callSet.call(METHOD_A_NAME, METHOD_A_ARGS)); methodA.verifyExpectations(); methodB.verifyExpectations(); @@ -66,7 +66,7 @@ callSet.addExpect(new CallOnceExpectation(anotherMethodASignature)); assertSame("expected result from method B, as expect has precendence over match", "result2", - callSet.call(unusedMock, METHOD_A_NAME, METHOD_A_ARGS)); + callSet.call(METHOD_A_NAME, METHOD_A_ARGS)); } public void testCallPassedToContainedElementsOtherOrder() @@ -84,7 +84,7 @@ callSet.addExpect(methodB); assertSame("expected result from method B", METHOD_B_RESULT, - callSet.call(unusedMock, METHOD_B_NAME, METHOD_B_ARGS)); + callSet.call(METHOD_B_NAME, METHOD_B_ARGS)); methodA.verifyExpectations(); methodB.verifyExpectations(); @@ -98,7 +98,7 @@ callSet.addExpect(mockCallable); - assertSame("result is returned by mock", result, callSet.call(unusedMock, "method", new Object[0])); + assertSame("result is returned by mock", result, callSet.call("method", new Object[0])); } public void testCallableThrowableThrown() @@ -111,7 +111,7 @@ callSet.addExpect(mockCallable); try { - callSet.call(unusedMock, "hello", new String[0]); + callSet.call("hello", new String[0]); } catch (Throwable ex) { assertSame("exception is caught by mock", throwable, ex); } @@ -138,7 +138,7 @@ callSet.addExpect(methodB); try { - callSet.call(unusedMock, methodCName, methodCArgs); + callSet.call(methodCName, methodCArgs); } catch (AssertionFailedError ex) { AssertMo.assertIncludes("method name is in error message", "methodC", ex.getMessage()); AssertMo.assertIncludes("argument is in error message (1)", methodCArgs[0], ex.getMessage()); Index: CallOnceExpectationTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/CallOnceExpectationTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CallOnceExpectationTest.java 20 May 2003 00:05:24 -0000 1.1 +++ CallOnceExpectationTest.java 12 Jun 2003 22:45:16 -0000 1.2 @@ -49,7 +49,7 @@ mockCallable.setupCallReturn( RESULT ); mockCallable.setExpectedVerifyCalls(1); - call.call( ignoredMock, METHOD_NAME, ARGS ); + call.call( METHOD_NAME, ARGS ); call.verify(); mockCallable.verifyExpectations(); @@ -66,7 +66,7 @@ mockCallable.setExpectedCall(ignoredMock, METHOD_NAME, ARGS); mockCallable.setupCallReturn(RESULT); - call.call( ignoredMock, METHOD_NAME, ARGS ); + call.call( METHOD_NAME, ARGS ); mockCallable.verifyExpectations(); } @@ -76,7 +76,7 @@ mockCallable.setupCallReturn(RESULT); assertTrue( "First time should match", call.matches(METHOD_NAME, ARGS)); - call.call(ignoredMock, METHOD_NAME, ARGS); + call.call(METHOD_NAME, ARGS); assertFalse( "Second time should not match", call.matches(METHOD_NAME, ARGS)); } @@ -84,7 +84,7 @@ mockCallable.setupCallReturn(RESULT); assertSame( "should return decorated's result", - RESULT, call.call( ignoredMock, METHOD_NAME, ARGS ) ); + RESULT, call.call( METHOD_NAME, ARGS ) ); mockCallable.verifyExpectations(); } @@ -95,7 +95,7 @@ mockCallable.setupCallThrow(exception); try { - call.call( ignoredMock, METHOD_NAME, ARGS ); + call.call( METHOD_NAME, ARGS ); fail("expected decorated's throwable to be thrown"); } catch( DummyThrowable ex ) { Index: StubTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/StubTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StubTest.java 18 May 2003 20:59:38 -0000 1.2 +++ StubTest.java 12 Jun 2003 22:45:16 -0000 1.3 @@ -21,11 +21,10 @@ ReturnStub stub = new ReturnStub(result); String ignoredMethodName = "methodName"; - Mock ignoredMock = null; Object[] ignoredArgs = new Object[0]; assertSame( "Should be the same result object", - result, stub.call( ignoredMock, ignoredMethodName, ignoredArgs ) ); + result, stub.call( ignoredMethodName, ignoredArgs ) ); } public void testThrowStub() { @@ -33,11 +32,10 @@ ThrowStub stub = new ThrowStub(throwable); String ignoredMethodName = "methodName"; - Mock ignoredMock = null; Object[] ignoredArgs = new Object[0]; try { - stub.call( ignoredMock, ignoredMethodName, ignoredArgs ); + stub.call( ignoredMethodName, ignoredArgs ); } catch( Throwable t ) { assertSame( "Should be the same throwable", throwable, t ); Index: MockCallable.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/MockCallable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MockCallable.java 18 May 2003 20:59:37 -0000 1.2 +++ MockCallable.java 12 Jun 2003 22:45:16 -0000 1.3 @@ -10,7 +10,6 @@ public class MockCallable implements Callable { private ExpectationCounter callCount = new ExpectationCounter("call.count"); - private ExpectationValue callMock = new ExpectationValue("call.mock"); private ExpectationValue callMethodName = new ExpectationValue("call.methodName"); private ExpectationList callArgs = new ExpectationList("call.args"); private ReturnValue callResult = new ReturnValue("call.return"); @@ -32,7 +31,6 @@ } public void setExpectedCall( Mock mock, String methodName, Object[] args ) { - callMock.setExpected(mock); callMethodName.setExpected(methodName); callArgs.addExpectedMany(args); } @@ -45,8 +43,7 @@ callThrow = thrown; } - public Object call(Mock mock, String methodName, Object[] args) throws Throwable { - callMock.setActual(mock); + public Object call(String methodName, Object[] args) throws Throwable { callMethodName.setActual(methodName); callArgs.addActualMany(args); callCount.inc(); Index: MockTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/MockTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- MockTest.java 19 May 2003 23:56:23 -0000 1.11 +++ MockTest.java 12 Jun 2003 22:45:16 -0000 1.12 @@ -344,7 +344,7 @@ } public void testMockProxySendsAllArgument() throws Throwable { - mockCallableAddable.addExpectedCall(mock, METHOD_TWOARG_NAME, METHOD_TWOARG_ARGS); + mockCallableAddable.addExpectedCall(METHOD_TWOARG_NAME, METHOD_TWOARG_ARGS); mockCallableAddable.setupCall("result ignored"); proxy.twoArgMethod(METHOD_TWOARG_ARGS[0], METHOD_TWOARG_ARGS[1]); @@ -354,7 +354,7 @@ public void testMockProxySendsEmptyArrayWhenNoArguments() throws Exception { - mockCallableAddable.addExpectedCall(mock, METHOD_NOARG_NAME, METHOD_NOARG_ARGS); + mockCallableAddable.addExpectedCall(METHOD_NOARG_NAME, METHOD_NOARG_ARGS); mockCallableAddable.setupCall("result ignored"); proxy.noArgMethodVoid(); |