Update of /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2219/input/javasrc/biz/xsoftware/mock
Modified Files:
MockSuperclass.java MockObject.java Behavior.java
Log Message:
api is ready for review....implementation does not work however.
Index: Behavior.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/Behavior.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Behavior.java 10 Sep 2006 18:25:52 -0000 1.1
--- Behavior.java 10 Sep 2006 18:44:06 -0000 1.2
***************
*** 9,23 ****
public interface Behavior
{
- /**
- * @param params
- * @return
- */
- public Object[] clone(Object[] params);
-
- /**
- * @param params
- */
- public Object runMethod(Object[] params);
}
--- 9,13 ----
Index: MockSuperclass.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockSuperclass.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MockSuperclass.java 10 Sep 2006 18:35:12 -0000 1.2
--- MockSuperclass.java 10 Sep 2006 18:44:06 -0000 1.3
***************
*** 119,142 ****
}
! public void addIgnore(String method)
{
ignoreImpl(method);
}
! public void addIgnore(String ... methods)
! {
! ignoreImpl(methods);
! }
!
! public void removeIgnore(String method)
{
removeIgnoreImpl(method);
}
- public void removeIgnore(String ... methods)
- {
- removeIgnoreImpl(methods);
- }
-
private void removeIgnoreImpl(String ... methods)
{
--- 119,132 ----
}
! public void addIgnoredMethod(String method, Class ... argTypes)
{
ignoreImpl(method);
}
! public void removeIgnoredMethod(String method, Class ... argTypes)
{
removeIgnoreImpl(method);
}
private void removeIgnoreImpl(String ... methods)
{
***************
*** 243,247 ****
if(retVal instanceof Behavior) {
! return ((Behavior)retVal).runMethod(params);
} else if(retVal instanceof Throwable) {
Throwable t = (Throwable)retVal;
--- 233,237 ----
if(retVal instanceof Behavior) {
! throw new UnsupportedOperationException("not supported yet");
} else if(retVal instanceof Throwable) {
Throwable t = (Throwable)retVal;
***************
*** 634,637 ****
--- 624,630 ----
}
+ public void setDefaultBehavior(Behavior b, String method, Class... argTypes) {
+ methodToDefaultRetVal.put(method, b);
+ }
public void setDefaultReturnValue(Object o, String method, Class... argTypes) {
methodToDefaultRetVal.put(method, o);
***************
*** 655,660 ****
Object action = actions.get(0);
if(action instanceof Behavior) {
! Behavior behavior = (Behavior)action;
! return behavior.clone(params);
}
}
--- 648,653 ----
Object action = actions.get(0);
if(action instanceof Behavior) {
! //Behavior behavior = (Behavior)action;
! throw new UnsupportedOperationException("not supported yet");
}
}
Index: MockObject.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib3/input/javasrc/biz/xsoftware/mock/MockObject.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MockObject.java 10 Sep 2006 18:35:12 -0000 1.2
--- MockObject.java 10 Sep 2006 18:44:06 -0000 1.3
***************
*** 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);
/**
--- 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); //, Class ... argTypes);
/**
***************
*** 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);
--- 104,113 ----
* called, it will not result in an exception.
*/
! public void addIgnoredMethod(String method, Class ... argTypes);
/**
* Removes the method from the ignored methods set.
*/
! public void removeIgnoredMethod(String method, Class ... argTypes);
public void setExpectTimeout(int timeout);
|