Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15513/input/javasrc/biz/xsoftware/mock2/impl
Modified Files:
Tag: branchForOffice
MockObjectSuperImpl.java
Log Message:
for home
Index: MockObjectSuperImpl.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock2/impl/MockObjectSuperImpl.java,v
retrieving revision 1.3.2.4
retrieving revision 1.3.2.5
diff -C2 -d -r1.3.2.4 -r1.3.2.5
*** MockObjectSuperImpl.java 18 Jan 2006 09:45:16 -0000 1.3.2.4
--- MockObjectSuperImpl.java 5 Feb 2006 10:30:03 -0000 1.3.2.5
***************
*** 17,20 ****
--- 17,21 ----
private static final long DEFAULT_TIME_OUT = 10000;
+ private static int Index=0;
/**
***************
*** 22,26 ****
*/
private List<CalledMethod> methodsCalled = new LinkedList<CalledMethod>();
!
/**
* A map of queues, containing objects to return when methods are called
--- 23,34 ----
*/
private List<CalledMethod> methodsCalled = new LinkedList<CalledMethod>();
! /**
! * List of the methods been called ,and store them
! */
! // private List<CalledMethod> calledMethodsStore=new LinkedList<CalledMethod>();
! /**
! * List of the methods that have been expected
! */
! private List<CalledMethod> methodsExpected=new LinkedList<CalledMethod>();
/**
* A map of queues, containing objects to return when methods are called
***************
*** 57,73 ****
if (methodName == null)
throw new IllegalArgumentException("methd name can not be null");
! verify();
! //waitForCalledMethod(methodName,DEFAULT_TIME_OUT);
! CalledMethod calledMethod=methodsCalled.remove(0);
! return calledMethod;
}
- //This class shows eclipse warnings....commented out to keep eclipse warnings at zero
- // private void waitForCalledMethod(String methodName,long timeout) {
- // // TODO Auto-generated method stub
- //
- // CalledMethod calledMethod=methodsCalled.remove(0);
- //
- //
- // }
public CalledMethod expect(Object returnValue, String methodName,
--- 65,72 ----
if (methodName == null)
throw new IllegalArgumentException("methd name can not be null");
! CalledMethod calledMethod=new CalledMethodImpl(methodName);
! methodsExpected.add(calledMethod);
! return methodsExpected.get(Index++);
}
public CalledMethod expect(Object returnValue, String methodName,
***************
*** 92,107 ****
public void verify(){
! // TODO Auto-generated method stub
! if(methodsCalled.size()<=0){
! try {
! this.wait(DEFAULT_TIME_OUT);
! } catch (InterruptedException e) {
! e.getMessage();
}
}
- for(int i=0;i<methodsCalled.size();i++){
- CalledMethod calledMethod=methodsCalled.remove(0);
-
- }
}
--- 91,102 ----
public void verify(){
! for(int i=0;i<methodsExpected.size();i++){
! if(methodsExpected.get(i).getMethodName()==methodsCalled.get(i).getMethodName()){
!
! methodsExpected.add(i,methodsCalled.get(i));
! methodsExpected.remove(i+1);
! //continue;
}
}
}
***************
*** 141,151 ****
params += array[array.length - 1];
}
!
! if (logger.isLoggable(Level.FINE))
! logger.log(Level.FINE, "method called=" + methodName + "(" + params
! + ") on obj=" + this);
String stackTrace="method Called="+methodName+"("+params+"on object"+this+")";
! methodsCalled.add(new CalledMethodImpl(methodName,parameters,stackTrace));
! this.notifyAll();
return getReturnValue(methodName);
--- 136,146 ----
params += array[array.length - 1];
}
!
String stackTrace="method Called="+methodName+"("+params+"on object"+this+")";
! CalledMethod calledMethod=new CalledMethodImpl(methodName,parameters,stackTrace);
! methodsCalled.add(calledMethod);
! //calledMethodsStore.add(calledMethod);
!
! //this.notifyAll();
return getReturnValue(methodName);
|