Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22874/input/javasrc/biz/xsoftware/mock2/impl
Modified Files:
MockObjectSuperImpl.java
Log Message:
Index: MockObjectSuperImpl.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/MockObjectSuperImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** MockObjectSuperImpl.java 25 Mar 2006 08:17:22 -0000 1.10
--- MockObjectSuperImpl.java 27 Mar 2006 15:44:31 -0000 1.11
***************
*** 84,87 ****
--- 84,88 ----
throw new IllegalArgumentException(Messages.METHOD_NAME_CANT_BE_NULL);
CalledMethod calledMethod = new CalledMethodImpl(methodName);
+ if(!methodsIgnored.containsKey(methodName))
methodsExpected.add(calledMethod);
return calledMethod;
***************
*** 93,98 ****
throw new IllegalArgumentException(Messages.METHOD_NAME_CANT_BE_NULL);
CalledMethod calledMethod = new CalledMethodImpl(methodName);
! methodsExpected.add(calledMethod);
! retVal.put(methodName, returnValue);
return calledMethod;
}
--- 94,101 ----
throw new IllegalArgumentException(Messages.METHOD_NAME_CANT_BE_NULL);
CalledMethod calledMethod = new CalledMethodImpl(methodName);
! if(!methodsIgnored.containsKey(methodName)){
! methodsExpected.add(calledMethod);
! retVal.put(methodName, returnValue);
! }
return calledMethod;
}
***************
*** 103,108 ****
throw new IllegalArgumentException(Messages.METHOD_NAME_CANT_BE_NULL);
CalledMethod calledMethod = new CalledMethodImpl(methodName);
! methodsExpected.add(calledMethod);
! methodWithException.put(methodName, throwable);
return calledMethod;
}
--- 106,113 ----
throw new IllegalArgumentException(Messages.METHOD_NAME_CANT_BE_NULL);
CalledMethod calledMethod = new CalledMethodImpl(methodName);
! if(!methodsIgnored.containsKey(methodName)){
! methodsExpected.add(calledMethod);
! methodWithException.put(methodName, throwable);
! }
return calledMethod;
}
***************
*** 113,129 ****
throw new IllegalArgumentException(Messages.METHOD_NAME_CANT_BE_NULL);
CalledMethod calledMethod=new CalledMethodImpl(methodName);
! methodsExpected.add(calledMethod);
! behaviorMap.put(methodName,behavior);
! try {
! Class c=behavior.getClass();
! Method method = c.getMethod(methodName,params);
! methodList.add(method);
! } catch (SecurityException e) {
! throw new IllegalArgumentException(Messages.METHOD_CAN_NOT_ACCESS);
! } catch (NoSuchMethodException e) {
! throw new IllegalArgumentException(methodName+"is not defined in your Behvior Implemetation");
! }
return calledMethod;
--- 118,136 ----
throw new IllegalArgumentException(Messages.METHOD_NAME_CANT_BE_NULL);
CalledMethod calledMethod=new CalledMethodImpl(methodName);
! if(!methodsIgnored.containsKey(methodName)){
! methodsExpected.add(calledMethod);
! behaviorMap.put(methodName,behavior);
! try {
! Class c=behavior.getClass();
! Method method = c.getMethod(methodName,params);
! methodList.add(method);
! } catch (SecurityException e) {
! throw new IllegalArgumentException(Messages.METHOD_CAN_NOT_ACCESS);
! } catch (NoSuchMethodException e) {
! throw new IllegalArgumentException(methodName+"is not defined in your Behvior Implemetation");
! }
! }
return calledMethod;
***************
*** 147,152 ****
while (methodsCalled.size() != 0) {
! CalledMethod calledMethod = methodsCalled.remove(0);
! CalledMethodImpl m = (CalledMethodImpl) methodsExpected.remove(0);
m.setParameters(calledMethod.getParameters());
m.setStackTrace(calledMethod.getStackTrace());
--- 154,163 ----
while (methodsCalled.size() != 0) {
! CalledMethodImpl m = (CalledMethodImpl) methodsExpected.remove(0);
! CalledMethod calledMethod = methodsCalled.remove(0);
! while(m.getMethodName()!=calledMethod.getMethodName()){
! calledMethod=methodsCalled.remove(0);
! }
!
m.setParameters(calledMethod.getParameters());
m.setStackTrace(calledMethod.getStackTrace());
***************
*** 220,224 ****
public void setDefaultReturnValue(Object returnValue, String methodName,
Class... vargs) {
!
--- 231,237 ----
public void setDefaultReturnValue(Object returnValue, String methodName,
Class... vargs) {
! if(methodName==null)
! throw new IllegalArgumentException(Messages.METHOD_NAME_CANT_BE_NULL);
! retVal.put(methodName,returnValue);
***************
*** 226,233 ****
public Object instance() {
! CalledMethod calledMethod=new CalledMethodImpl();
!
! return calledMethod;
!
}
--- 239,243 ----
public Object instance() {
! return this;
}
|