Update of /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9156/input/javasrc/biz/xsoftware/test/mock2
Modified Files:
Tag: branchForOffice
TestMockCreator.java
Log Message:
pass
Index: TestMockCreator.java
===================================================================
RCS file: /cvsroot/mocklib/mocklib2/input/javasrc/biz/xsoftware/test/mock2/Attic/TestMockCreator.java,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** TestMockCreator.java 5 Feb 2006 12:35:43 -0000 1.1.2.8
--- TestMockCreator.java 6 Feb 2006 16:02:30 -0000 1.1.2.9
***************
*** 21,30 ****
ListenerOne l=(ListenerOne)m;
! String param="some params";
! l.callMeSecond(param);
String methodName="callMeSecond";
CalledMethod method=m.expect(methodName);
try {
--- 21,32 ----
ListenerOne l=(ListenerOne)m;
!
String methodName="callMeSecond";
CalledMethod method=m.expect(methodName);
+
+ // String param="some params";
+ // l.callMeSecond(param);
try {
***************
*** 41,45 ****
MockObject m = MockObjectFactory.createMock(ListenerOne.class);
ListenerOne l=(ListenerOne)m;
-
String methodName1 = "callMeFirst";
String methodName2="callMeSecond";
--- 43,46 ----
***************
*** 72,76 ****
assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName());
Object[] array = callMeFirst.getParameters();
! assertEquals("params should equal", param, array[0]);
assertEquals("param count should be 1", 1, callMeFirst.getParameters().length);
--- 73,77 ----
assertEquals("the methodName should be the same",methodName1,callMeFirst.getMethodName());
Object[] array = callMeFirst.getParameters();
! assertEquals("params should equal", var1, array[0]);
assertEquals("param count should be 1", 1, callMeFirst.getParameters().length);
***************
*** 80,143 ****
}
! // public void testTwoMethodsOnThread() throws Exception {
! // MockObject m = MockObjectFactory.createMock(ListenerOne.class);
! // final ListenerOne l = (ListenerOne) m;
! //
! // String methodName1 = "callMeFirst";
! // String methodName2 = "callMeSecond";
! // CalledMethod callMeFirst = m.expect(methodName1);
! // CalledMethod callMeSecond = m.expect(methodName2);
! //
! // final int var1 = 4;
! // final String param = "some params";
! // Thread t = new Thread() {
! // public void run() {
! // try {
! // Thread.sleep(1000);
! // l.callMeFirst(var1);
! // l.callMeSecond(param);
! // } catch (Exception e) {
! // log.log(Level.WARNING, "exception", e);
! // throw new RuntimeException(e);
! // }
! // }
! // };
! // t.start();
! //
! // m.verify();
! //
! // assertEquals("the methodName should be the same", methodName1,
! // callMeFirst.getMethodName());
! // assertEquals("params should equal", param,
! // callMeFirst.getParameters()[0]);
! // assertEquals("param count should be 1", 1,
! // callMeFirst.getParameters().length);
! //
! // assertEquals("the methodName should be the same", methodName2,
! // callMeSecond.getMethodName());
! // assertEquals("params should equal", param,
! // callMeSecond.getParameters()[0]);
! // assertEquals("param count should be 1", 1,
! // callMeSecond.getParameters().length);
! // }
! // public void testFailure() throws Exception {
! // MockObject m = MockObjectFactory.createMock(ListenerOne.class);
! // ListenerOne l=(ListenerOne)m;
! //
! // String param="some params";
! // l.callMeSecond(param);
! //
! // String methodName="callMeSecond";
! //
! // CalledMethod method=m.expect(methodName);
! //
! // try {
! // assertEquals("params should equal", param, method.getParameters()[0]);
! // fail("This should fail since m.verify() is not called");
! // } catch(IllegalStateException e) {
! // assertEquals(Messages.VERIFY_NOT_CALLED, e.getMessage());
! // }
! // }
}
--- 81,144 ----
}
! public void testTwoMethodsOnThread() throws Exception {
! MockObject m = MockObjectFactory.createMock(ListenerOne.class);
! final ListenerOne l = (ListenerOne) m;
!
! String methodName1 = "callMeFirst";
! String methodName2 = "callMeSecond";
! CalledMethod callMeFirst = m.expect(methodName1);
! CalledMethod callMeSecond = m.expect(methodName2);
!
! final int var1 = 4;
! final String param = "some params";
! Thread t = new Thread() {
! public void run() {
! try {
! Thread.sleep(1000);
! l.callMeFirst(var1);
! l.callMeSecond(param);
! } catch (Exception e) {
! log.log(Level.WARNING, "exception", e);
! throw new RuntimeException(e);
! }
! }
! };
! t.start();
!
! m.verify();
!
! assertEquals("the methodName should be the same", methodName1,
! callMeFirst.getMethodName());
! assertEquals("params should equal", var1,
! callMeFirst.getParameters()[0]);
! assertEquals("param count should be 1", 1,
! callMeFirst.getParameters().length);
!
! assertEquals("the methodName should be the same", methodName2,
! callMeSecond.getMethodName());
! assertEquals("params should equal", param,
! callMeSecond.getParameters()[0]);
! assertEquals("param count should be 1", 1,
! callMeSecond.getParameters().length);
! }
! public void testFailure() throws Exception {
! MockObject m = MockObjectFactory.createMock(ListenerOne.class);
! ListenerOne l=(ListenerOne)m;
!
! String param="some params";
! l.callMeSecond(param);
!
! String methodName="callMeSecond";
!
! CalledMethod method=m.expect(methodName);
!
! try {
! assertEquals("params should equal", param, method.getParameters()[0]);
! fail("This should fail since m.verify() is not called");
! } catch(IllegalStateException e) {
! //assertEquals(Messages.VERIFY_NOT_CALLED, e.getMessage());
! }
! }
}
|