Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19153/input/javasrc/biz/xsoftware/mock2/impl
Modified Files:
MockObjectSuperImpl.java
Log Message:
get dean's 2 test pass , add expectFailedException to mocklib2
Index: MockObjectSuperImpl.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/MockObjectSuperImpl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** MockObjectSuperImpl.java 5 Apr 2006 15:27:08 -0000 1.12
--- MockObjectSuperImpl.java 6 Apr 2006 15:25:03 -0000 1.13
***************
*** 1,5 ****
package biz.xsoftware.mock2.impl;
-
import java.lang.reflect.Method;
import java.util.HashMap;
--- 1,4 ----
***************
*** 12,15 ****
--- 11,15 ----
import biz.xsoftware.mock2.Behavior;
import biz.xsoftware.mock2.CalledMethod;
+ import biz.xsoftware.mock2.ExpectFailedException;
import biz.xsoftware.mock2.MockObject;
import biz.xsoftware.mock2.Messages;
***************
*** 18,22 ****
*
* @author huajie.zeng
! *
*/
public abstract class MockObjectSuperImpl implements MockObject {
--- 18,22 ----
*
* @author huajie.zeng
! *
*/
public abstract class MockObjectSuperImpl implements MockObject {
***************
*** 30,64 ****
/**
! * List of the current methods that have been called.
! */
private List<CalledMethod> methodsCalled = new LinkedList<CalledMethod>();
/**
! * a Map of return value which the method with return value has
! */
private Map<String, Object> retVal = new HashMap<String, Object>();
/**
! * List of the methods that have been expected
! */
private List<CalledMethod> methodsExpected = new LinkedList<CalledMethod>();
/**
! * A map of methods which will throw exception
! */
private Map<String, Throwable> methodWithException = new HashMap<String, Throwable>();
/**
! * A List of Method
! */
private List<Method> methodList=new LinkedList<Method>();
/**
! * a Map of behavior impl which is passed in by expect method
! */
private Map<String,Behavior> behaviorMap=new HashMap<String,Behavior>();
/**
! * A Map of methods which are ignored by tester
! */
private Map<String,CalledMethod> methodsIgnored=new HashMap<String,CalledMethod>();
--- 30,64 ----
/**
! * List of the current methods that have been called.
! */
private List<CalledMethod> methodsCalled = new LinkedList<CalledMethod>();
/**
! * a Map of return value which the method with return value has
! */
private Map<String, Object> retVal = new HashMap<String, Object>();
/**
! * List of the methods that have been expected
! */
private List<CalledMethod> methodsExpected = new LinkedList<CalledMethod>();
/**
! * A map of methods which will throw exception
! */
private Map<String, Throwable> methodWithException = new HashMap<String, Throwable>();
/**
! * A List of Method
! */
private List<Method> methodList=new LinkedList<Method>();
/**
! * a Map of behavior impl which is passed in by expect method
! */
private Map<String,Behavior> behaviorMap=new HashMap<String,Behavior>();
/**
! * A Map of methods which are ignored by tester
! */
private Map<String,CalledMethod> methodsIgnored=new HashMap<String,CalledMethod>();
***************
*** 186,194 ****
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());
--- 186,209 ----
while (methodsCalled.size() != 0) {
CalledMethod calledMethod = methodsCalled.remove(0);
! CalledMethodImpl m=new CalledMethodImpl();
! if(methodsExpected.size()!=0){
! m = (CalledMethodImpl) methodsExpected.remove(0);
! while(m.getMethodName()!=calledMethod.getMethodName()){
! if(methodsIgnored.containsKey(m.getMethodName())){
! calledMethod=methodsCalled.remove(0);
! }else
! {
! throw new ExpectFailedException(Messages.ORDER_EXCEPTION);
! }
!
! }
! }else if(methodsIgnored.containsKey(calledMethod.getMethodName())){
! continue;
! }else
! {
! throw new ExpectFailedException(Messages.TOO_MANY_METHODS_CALLED);
}
+
m.setParameters(calledMethod.getParameters());
|