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(); } }
public void testPassesWhenCalledTheExactNumberOfTimes() { proxy.m(); proxy.m(); mock.verify(); }