/*
  * Call reset() in the catch blocks for these two methods,
  * otherwise the MockObjectTestCase infrastructure picks up
  * the errors and rethrows the exception.
  */
 public void testFailsWhenCalledFewerThanTheExactNumberOfTimes() {
   proxy.m();
   try {
     mock.verify();
   } catch (AssertionFailedError err) {
     mock.reset();
     return;
   }
   fail("Should have failed");
 }
コード例 #2
0
 public void testFailsWhenCalledMoreThanTheExactNumberOfTimes() {
   proxy.m();
   proxy.m();
   try {
     proxy.m();
   } catch (Error error) {
     if (!(error instanceof MockAssertionError)) {
       fail("Should have failed");
     }
     mock.reset();
   }
 }
コード例 #3
0
 /*
  * Call reset() in the catch blocks for these two methods,
  * otherwise the MockObjectTestCase infrastructure picks up
  * the errors and rethrows the exception.
  */
 @Test
 public void failsWhenCalledFewerThanTheExactNumberOfTimes() {
   proxy.m();
   try {
     mock.verify();
   } catch (Error error) {
     if (!(error instanceof MockAssertionError)) {
       fail("Should have failed");
     }
     mock.reset();
   }
 }