Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31858/input/javasrc/biz/xsoftware/impl/mock
Modified Files:
MethodVerifier.java MockSuperclass.java MessageHelper.java
ThrowException.java
Log Message:
change build template
Index: MockSuperclass.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MockSuperclass.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** MockSuperclass.java 14 Nov 2007 03:13:32 -0000 1.10
--- MockSuperclass.java 5 Dec 2007 04:55:21 -0000 1.11
***************
*** 188,193 ****
* @return whatever the client has specified using addReturnValue
*/
! protected Object methodCalled(String method, Object parameters) {
try {
if(!(parameters instanceof Object[])) {
parameters = new Object[] {parameters};
--- 188,194 ----
* @return whatever the client has specified using addReturnValue
*/
! protected Object methodCalled(String method, Object params) {
try {
+ Object parameters = params;
if(!(parameters instanceof Object[])) {
parameters = new Object[] {parameters};
***************
*** 202,206 ****
}
! protected synchronized Object methodCalledImpl(String method, Object[] parameters) throws Throwable {
method = method.intern();
String params = "";
--- 203,208 ----
}
! protected synchronized Object methodCalledImpl(String aMethod, Object[] parameters) throws Throwable {
! String method = aMethod ;
method = method.intern();
String params = "";
***************
*** 393,398 ****
}
! protected synchronized CalledMethod expectUnignoredCall(String method, Set<String> ignorables, List<CalledMethod> calledMethods) {
!
if(method == null)
method = NONE;
--- 395,400 ----
}
! protected synchronized CalledMethod expectUnignoredCall(String aMethod, Set<String> ignorables, List<CalledMethod> calledMethods) {
! String method = aMethod;
if(method == null)
method = NONE;
Index: ThrowException.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/ThrowException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ThrowException.java 1 Oct 2006 03:18:44 -0000 1.2
--- ThrowException.java 5 Dec 2007 04:55:21 -0000 1.3
***************
*** 3,7 ****
public class ThrowException implements Action {
! private Throwable e;
public ThrowException(Throwable e) {
--- 3,7 ----
public class ThrowException implements Action {
! private final Throwable e;
public ThrowException(Throwable e) {
Index: MethodVerifier.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MethodVerifier.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MethodVerifier.java 14 May 2007 18:31:26 -0000 1.4
--- MethodVerifier.java 5 Dec 2007 04:55:21 -0000 1.5
***************
*** 75,78 ****
--- 75,79 ----
List<Method> matchingMethods = findMatchingMethods(methods, method, argTypes);
+ Method retVal = null;
if(matchingMethods == null) {
String classNames = getClassNamesString(classes);
***************
*** 81,87 ****
"\nfollowing Classes/Interfaces"+classNames);
} else if(matchingMethods.size() == 1) {
! return matchingMethods.get(0);
} else if(!isVerifyArgs && matchingMethods.size() > 0) {
! return null; //don't need to return anything for this.
} else {
String msg = "Too many methods match your method expected='"+method+"'. Methods found:\n";
--- 82,88 ----
"\nfollowing Classes/Interfaces"+classNames);
} else if(matchingMethods.size() == 1) {
! retVal = matchingMethods.get(0);
} else if(!isVerifyArgs && matchingMethods.size() > 0) {
! retVal = null; //don't need to return anything for this.
} else {
String msg = "Too many methods match your method expected='"+method+"'. Methods found:\n";
***************
*** 93,96 ****
--- 94,98 ----
throw new IllegalArgumentException(msg);
}
+ return retVal;
}
***************
*** 147,150 ****
--- 149,154 ----
return null;
+ List<Method> retVal = null;
+
List<Method> narrowedMatches = new ArrayList<Method>();
//find one that takes no args if that is what we are looking for...
***************
*** 153,160 ****
if(method.getParameterTypes() == null || method.getParameterAnnotations().length == 0) {
narrowedMatches.add(method);
! return narrowedMatches;
}
}
! return matches;
}
--- 157,166 ----
if(method.getParameterTypes() == null || method.getParameterAnnotations().length == 0) {
narrowedMatches.add(method);
! retVal = narrowedMatches;
! break;
}
}
! if(retVal == null)
! retVal = matches;
}
***************
*** 164,172 ****
if(isArgTypesMatch(types, argTypes)) {
narrowedMatches.add(method);
! return narrowedMatches;
}
}
! return null;
}
--- 170,179 ----
if(isArgTypesMatch(types, argTypes)) {
narrowedMatches.add(method);
! retVal = narrowedMatches;
! break;
}
}
! return retVal;
}
Index: MessageHelper.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/impl/mock/MessageHelper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MessageHelper.java 14 May 2007 18:31:21 -0000 1.4
--- MessageHelper.java 5 Dec 2007 04:55:21 -0000 1.5
***************
*** 6,9 ****
--- 6,10 ----
import java.util.List;
import java.util.Set;
+ import java.util.logging.Logger;
import biz.xsoftware.mock.CalledMethod;
***************
*** 62,65 ****
--- 63,67 ----
public static String getHowMethodWasCalled(CalledMethod method) {
+ Logger log = Logger.getLogger(MessageHelper.class.getName());
Throwable t = method.getHowItWasCalled();
String retVal = "\nThe last method was="+method.getMethodName();
***************
*** 69,73 ****
StringWriter s = new StringWriter();
PrintWriter p = new PrintWriter(s);
! t.printStackTrace(p);
retVal += s.toString();
retVal += "--------END="+method.getMethodName() +"---------------\n";
--- 71,75 ----
StringWriter s = new StringWriter();
PrintWriter p = new PrintWriter(s);
! log.info(t.getMessage());
retVal += s.toString();
retVal += "--------END="+method.getMethodName() +"---------------\n";
|