Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20724/input/javasrc/biz/xsoftware/mock
Modified Files:
MockObject.java MockSuperclass.java MockObjectImpl.java
Log Message:
changed the api to use varargs for expect and ignore. also added a single arg version of each for eclipse content assist happiness.
Index: MockSuperclass.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock/MockSuperclass.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MockSuperclass.java 10 Jun 2006 12:54:36 -0000 1.8
--- MockSuperclass.java 4 Aug 2006 16:20:52 -0000 1.9
***************
*** 118,121 ****
--- 118,131 ----
return waitTime;
}
+
+ public void ignore(String method)
+ {
+ ignore(method);
+ }
+
+ public void ignore(String ... methods)
+ {
+ setIgnoredMethods(methods);
+ }
public void setIgnoredMethods(String[] methods) {
***************
*** 133,137 ****
*
* @param method
! * @param param
* @return whatever the client has specified using addReturnValue
*/
--- 143,147 ----
*
* @param method
! * @param parameters
* @return whatever the client has specified using addReturnValue
*/
***************
*** 283,287 ****
*/
public CalledMethod expectCall(String method) {
! return expectOrderedCalls(new String[] {method})[0];
}
--- 293,312 ----
*/
public CalledMethod expectCall(String method) {
! return expect(new String[] {method})[0];
! }
!
! /**
! * @see biz.xsoftware.mock.MockObject#expect(java.lang.String)
! */
! public CalledMethod expect(String method) {
! return expect(new String[] {method})[0];
! }
!
! /**
! * @see biz.xsoftware.mock.MockObject#expect(java.lang.String[])
! */
! public synchronized CalledMethod[] expect(String ... methods)
! {
! return expectOrderedCalls(methods);
}
Index: MockObject.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock/MockObject.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MockObject.java 10 Jun 2006 12:41:03 -0000 1.4
--- MockObject.java 4 Aug 2006 16:20:52 -0000 1.5
***************
*** 34,40 ****
* @param method The expected method.
* @return An array of params that were passed to the methods called
*/
public CalledMethod expectCall(String method);
!
/**
* Waits for all the methods to be called. If any of the methods
--- 34,66 ----
* @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);
!
! /**
! * 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 method(s) in the correct order.
! * @return An array or arrays of params that were passed to the methods called
! */
! public CalledMethod[] expect(String ... methods);
!
/**
* Waits for all the methods to be called. If any of the methods
***************
*** 47,50 ****
--- 73,78 ----
* @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);
***************
*** 57,60 ****
--- 85,90 ----
* @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);
***************
*** 101,106 ****
--- 131,151 ----
* 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 ignore(String method);
+
+ /**
+ * When calling expect, 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.
+ */
+ public void ignore(String ... methods);
public void setCloner(Cloner c);
Index: MockObjectImpl.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/mock/MockObjectImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MockObjectImpl.java 19 Feb 2006 19:20:52 -0000 1.6
--- MockObjectImpl.java 4 Aug 2006 16:20:52 -0000 1.7
***************
*** 14,24 ****
-
-
/**
* @author Dean Hiller
- *
- * To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
*/
class MockObjectImpl extends MockSuperclass implements InvocationHandler {
--- 14,19 ----
|