From: Nat P. <np...@us...> - 2002-10-14 14:42:52
|
Update of /cvsroot/mockobjects/nat/jmock/test/com/b13media/mock In directory usw-pr-cvs1:/tmp/cvs-serv12855/test/com/b13media/mock Modified Files: Test_Mock.java Log Message: Added expectNotCalled method to Mock class. Index: Test_Mock.java =================================================================== RCS file: /cvsroot/mockobjects/nat/jmock/test/com/b13media/mock/Test_Mock.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Test_Mock.java 11 Oct 2002 14:57:35 -0000 1.2 +++ Test_Mock.java 14 Oct 2002 14:42:47 -0000 1.3 @@ -194,7 +194,7 @@ fail( "strict mock did not fail when unexpected method was called" ); } - public void testUnexpectedMethodDoesNotThrowsWhenNotStrict() { + public void testUnexpectedMethodDoesNotThrowWhenNotStrict() { try { _interface.voidMethod(); } @@ -276,6 +276,27 @@ } fail( "mock did not enforce order of calls" ); + } + + public void testExpectNotCalled() { + _mock.expectNotCalled("noArgs"); + try { + _interface.noArgs(); + } + catch( AssertionFailedError ex ) { + return; + } + + fail("AssertionFailedError expected"); + } + + public void testExpectNotCalledClearedBySubsequentExpectation() { + _mock.expectNotCalled("noArgs"); + _mock.expectVoid( "noArgs", Mock.NO_ARGS ); + + _interface.noArgs(); + + _mock.verify(); } public void testNoErrorWhenOrderedMethodsCalledInCorrectOrder() { |