Update of /cvsroot/mockobject/mockobject2/input/javasrc/biz/xsoftware/mock
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2628/input/javasrc/biz/xsoftware/mock
Modified Files:
MockObjectFactory.java MockObjectImpl.java MockSuperclass.java
Log Message:
force error if they try to expect an invalid method.
Index: MockSuperclass.java
===================================================================
RCS file: /cvsroot/mockobject/mockobject2/input/javasrc/biz/xsoftware/mock/MockSuperclass.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** MockSuperclass.java 18 Mar 2005 16:00:58 -0000 1.10
--- MockSuperclass.java 20 Mar 2005 13:45:42 -0000 1.11
***************
*** 1,531 ****
! package biz.xsoftware.mock;
!
! import java.io.PrintWriter;
! import java.io.StringWriter;
! import java.lang.reflect.Method;
! import java.util.ArrayList;
! import java.util.Arrays;
! import java.util.HashMap;
! import java.util.LinkedList;
! import java.util.List;
[...1054 lines suppressed...]
!
! public void setDefaultReturnValue(String method, Object o) {
! methodToDefaultRetVal.put(method, o);
! }
!
! /**
! * Only needs to be overridden if the events are modifiable.
! * If the event is immutable, this does not need to be
! * overridden. To override this function, you just need to
! * copy the object and return a new one.
! *
! * @param o
! * @return
! */
! protected Object[] clone(Object[] params) {
! return params;
! }
!
! abstract public Class[] getClasses();
! }
Index: MockObjectImpl.java
===================================================================
RCS file: /cvsroot/mockobject/mockobject2/input/javasrc/biz/xsoftware/mock/MockObjectImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MockObjectImpl.java 12 Sep 2004 07:14:10 -0000 1.1
--- MockObjectImpl.java 20 Mar 2005 13:45:42 -0000 1.2
***************
*** 24,27 ****
--- 24,28 ----
private static Map isMethodInSuper = new HashMap();
+ private Class[] classes;
static {
***************
*** 39,42 ****
--- 40,46 ----
}
+ public MockObjectImpl(Class[] interfaces) {
+ this.classes = interfaces;
+ }
/* (non-Javadoc)
* @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
***************
*** 73,75 ****
--- 77,85 ----
}
}
+ /* (non-Javadoc)
+ * @see biz.xsoftware.mock.MockSuperclass#getClasses()
+ */
+ public Class[] getClasses() {
+ return classes;
+ }
}
Index: MockObjectFactory.java
===================================================================
RCS file: /cvsroot/mockobject/mockobject2/input/javasrc/biz/xsoftware/mock/MockObjectFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MockObjectFactory.java 12 Sep 2004 07:14:10 -0000 1.1
--- MockObjectFactory.java 20 Mar 2005 13:45:42 -0000 1.2
***************
*** 63,67 ****
ClassLoader cl = MockObjectFactory.class.getClassLoader();
! Object o = Proxy.newProxyInstance(cl, interfacesPlusMock, new MockObjectImpl());
MockObject m = (MockObject)o;
return m;
--- 63,68 ----
ClassLoader cl = MockObjectFactory.class.getClassLoader();
! MockObjectImpl impl = new MockObjectImpl(interfaces);
! Object o = Proxy.newProxyInstance(cl, interfacesPlusMock, impl);
MockObject m = (MockObject)o;
return m;
|