Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv31015/input/javasrc/biz/xsoftware/mock
Modified Files:
MockSuperclass.java MockObject.java
Log Message:
take a guess at the new mocklib3 api.
Index: MockSuperclass.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockSuperclass.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MockSuperclass.java 10 Sep 2006 18:25:51 -0000 1.1
--- MockSuperclass.java 10 Sep 2006 18:35:12 -0000 1.2
***************
*** 605,611 ****
}
/**
! * @see biz.xsoftware.mock.MockObject#addThrowException(java.lang.String, java.lang.Throwable)
*/
! public synchronized void addThrowException(String method, Throwable e) {
if(method == null)
throw new IllegalArgumentException("method parameter cannot be null");
--- 605,611 ----
}
/**
! * @see biz.xsoftware.mock.MockObject#addThrowException(java.lang.Throwable, java.lang.String, Class...)
*/
! public synchronized void addThrowException(Throwable e, String method, Class... argTypes) {
if(method == null)
throw new IllegalArgumentException("method parameter cannot be null");
***************
*** 621,627 ****
/**
! * @see biz.xsoftware.mock.MockObject#addReturnValue(java.lang.String, java.lang.Object)
*/
! public synchronized void addReturnValue(String method, Object o) {
if(method == null)
throw new IllegalArgumentException("method parameter cannot be null");
--- 621,627 ----
/**
! * @see biz.xsoftware.mock.MockObject#addReturnValue(java.lang.Object, java.lang.String, Class...)
*/
! public synchronized void addReturnValue(Object o, String method, Class... argTypes) {
if(method == null)
throw new IllegalArgumentException("method parameter cannot be null");
***************
*** 634,638 ****
}
! public void setDefaultReturnValue(String method, Object o) {
methodToDefaultRetVal.put(method, o);
}
--- 634,638 ----
}
! public void setDefaultReturnValue(Object o, String method, Class... argTypes) {
methodToDefaultRetVal.put(method, o);
}
***************
*** 675,679 ****
}
! public void addBehavior(String method, Behavior behavior) {
if(method == null)
throw new IllegalArgumentException("method parameter cannot be null");
--- 675,679 ----
}
! public void addBehavior(Behavior behavior, String method, Class... argTypes) {
if(method == null)
throw new IllegalArgumentException("method parameter cannot be null");
Index: MockObject.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObject.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MockObject.java 10 Sep 2006 18:25:52 -0000 1.1
--- MockObject.java 10 Sep 2006 18:35:12 -0000 1.2
***************
*** 26,52 ****
public static String ANY = "'Any method'";
! /**
! * Waits for one and only one method to be called. If any methods are
! * called before or after this one(after can sometimes be caught by
! * the MockObject when the threading is not synchronous), then
! * this call will throw an ExpectFailedException.
! *
! * @param method The expected method.
! * @return An array of params that were passed to the methods called
! *
! * @deprecated please use expect(String method)
! */
! public CalledMethod expectCall(String method);
!
! /**
! * Waits for one and only one method to be called. If any methods are
! * called before or after this one(after can sometimes be caught by
! * the MockObject when the threading is not synchronous), then
! * this call will throw an ExpectFailedException.
! *
! * @param method The expected method.
! * @return An array of params that were passed to the methods called
! */
! public CalledMethod expect(String method);
/**
--- 26,39 ----
public static String ANY = "'Any method'";
! // /**
! // * Waits for one and only one method to be called. If any methods are
! // * called before or after this one(after can sometimes be caught by
! // * the MockObject when the threading is not synchronous), then
! // * this call will throw an ExpectFailedException.
! // *
! // * @param method The expected method.
! // * @return An array of params that were passed to the methods called
! // */
! // public CalledMethod expect(String method);
/**
***************
*** 64,93 ****
/**
! * Waits for all the methods to be called. If any of the methods
! * are not called or are called out of order, this method throws
! * an exception which will fail the test case. For each method,
! * this will wait WAIT_TIME milliseconds for each method to be called.
! * If the method is not called within this period, an exception will
! * be thrown saying 'method' was not called within timeout period.
! *
! * @param methods The expected methods in the correct order.
! * @return An array or arrays of params that were passed to the methods called
! *
! * @deprecated please use expectCall(String ... methods)
! */
! public CalledMethod[] expectOrderedCalls(String[] methods);
!
! /**
! * Expect many methods to be called irrelevant of the order in which they are
! * called.
! *
! * @param methods The methods to be called in no particular order
! * @return An array of params that were passed to the methods called. This
! * array lines up with the methods array passed in.
! *
! * @deprecated this will go away soon, unless you email me that you depend on it.
*/
! public CalledMethod[] expectUnorderedCalls(String[] methods);
!
/**
* Add an exception to throw when a method on the mockObject is called.
--- 51,63 ----
/**
! * Set the DefaultReturnValue for a 'method'
! * @param method The method
! * @param argTypes TODO
*/
! public void setDefaultReturnValue(Object o, String method, Class... argTypes);
!
!
! public void setDefaultBehavior(Behavior b, String method, Class ... argTypes);
!
/**
* Add an exception to throw when a method on the mockObject is called.
***************
*** 106,114 ****
* <li> RuntimeException for Subclasses of MockSuperclass</li>
* </ol>
- *
- * @param method The method to throw the exception on when it is called.
* @param e The exception to throw on method.
*/
! public void addThrowException(String method, Throwable e);
/**
* Add a return value to return when 'method' is called.
--- 76,84 ----
* <li> RuntimeException for Subclasses of MockSuperclass</li>
* </ol>
* @param e The exception to throw on method.
+ * @param method The method to throw the exception on when it is called.
+ * @param argTypes TODO
*/
! public void addThrowException(Throwable e, String method, Class... argTypes);
/**
* Add a return value to return when 'method' is called.
***************
*** 121,146 ****
* <br></br>
* Use Integer to return int, Long for long, etc.
- *
- * @param method The method that when called returns first value on queue
* @param o The object to return that is added to the queue
*/
! public void addReturnValue(String method, Object o);
!
! /**
! * When calling expectCall, the MockObject will ignore the methods
! * in 'methods' variable so if one of the methods in this array is
! * called, it will not result in an exception.
! *
! * @deprecated please use ignore(String ... methods)
! */
! public void setIgnoredMethods(String[] methods);
!
!
! /**
! * When calling expect, the MockObject will ignore this method,
! * so it will not result in an exception.
! */
! public void addIgnore(String method);
!
/**
* When calling expect, the MockObject will ignore the methods
--- 91,102 ----
* <br></br>
* Use Integer to return int, Long for long, etc.
* @param o The object to return that is added to the queue
+ * @param method The method that when called returns first value on queue
+ * @param argTypes TODO
*/
! public void addReturnValue(Object o, String method, Class... argTypes);
!
! public void addBehavior(Behavior behavior, String string, Class... argTypes);
!
/**
* When calling expect, the MockObject will ignore the methods
***************
*** 148,170 ****
* called, it will not result in an exception.
*/
! public void addIgnore(String ... methods);
!
/**
* Removes the method from the ignored methods set.
*/
! public void removeIgnore(String method);
!
! /**
! * Removes the methods from the ignored methods set.
! */
! public void removeIgnore(String ... methods);
!
! public void setCloner(Cloner c);
! /**
! * Set the DefaultReturnValue for a 'method'
! * @param method The method
! */
! public void setDefaultReturnValue(String method, Object o);
public void setExpectTimeout(int timeout);
--- 104,113 ----
* called, it will not result in an exception.
*/
! public void addIgnoredMethods(String ... methods);
/**
* Removes the method from the ignored methods set.
*/
! public void removeIgnoredMethods(String ... method);
public void setExpectTimeout(int timeout);
***************
*** 172,176 ****
public int getExpectTimeout();
- public void addBehavior(String string, Behavior behavior);
-
}
--- 115,117 ----
|