Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv3420/src/core/com/mockobjects/dynamic
Modified Files:
Mock.java
Log Message:
Renamed some methods to be more readable
Index: Mock.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/Mock.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Mock.java 19 May 2003 23:56:23 -0000 1.19
+++ Mock.java 21 May 2003 07:57:11 -0000 1.20
@@ -9,7 +9,7 @@
import com.mockobjects.Verifiable;
import com.mockobjects.constraint.Constraint;
-public class Mock implements InvocationHandler,Verifiable {
+public class Mock implements InvocationHandler, Verifiable {
private String name;
private Object proxy;
private CallFactory callFactory;
@@ -53,10 +53,10 @@
// Can't overload this method as callee had an Object parameter, and java
// doesn't do a secondary dispatch on the true underlying type
- if(constraintArg instanceof Constraint[]) {
+ if (constraintArg instanceof Constraint[]) {
// to support possible legacy usage of new Contraint[] {...}
return new FullConstraintMatcher((Constraint[])constraintArg);
- } else if(constraintArg instanceof Constraint) {
+ } else if (constraintArg instanceof Constraint) {
// to support usage of C.lt(5) type constraints
return C.args((Constraint)constraintArg);
} else {
@@ -80,24 +80,23 @@
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
try {
- if(checkingProxyEquality(method, args)) {
+ if (isCheckingEqualityOnProxy(method, args)) {
return new Boolean(args[0] == this.proxy);
- } else if(gettingMockName(method, args)) {
+ } else if (isMockNameGetter(method, args)) {
return this.getMockName();
} else {
- Object result = callSequence.call(this, method.getName(), ((args == null) ? new Object[0] : args));
- return result;
+ return callSequence.call(this, method.getName(), (args == null ? new Object[0] : args));
}
} catch (AssertionFailedError ex) {
throw new AssertionFailedError(name + ": " + ex.getMessage());
}
}
- private boolean checkingProxyEquality(Method method, Object[] args) {
+ private boolean isCheckingEqualityOnProxy(Method method, Object[] args) {
return (method.getName().equals("equals")) && (args.length == 1) && (Proxy.isProxyClass(args[0].getClass()));
}
- private boolean gettingMockName(Method method, Object[] args) {
+ private boolean isMockNameGetter(Method method, Object[] args) {
return (method.getName().equals("getMockName")) && (args.length == 0);
}
|