/* * 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"); }
public void testFailsWhenCalledMoreThanTheExactNumberOfTimes() { proxy.m(); proxy.m(); try { proxy.m(); } catch (Error error) { if (!(error instanceof MockAssertionError)) { fail("Should have failed"); } mock.reset(); } }
/* * 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(); } }