public void testFailsWhenCalledMoreThanTheExactNumberOfTimes() { proxy.m(); proxy.m(); try { proxy.m(); } 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(); } }
ExpectationsModifier(ClassLoader classLoader, ClassReader classReader, MockedType typeMetadata) { super(classReader); if (typeMetadata == null) { mockingCfg = null; } else { mockingCfg = typeMetadata.mockingCfg; stubOutClassInitialization = typeMetadata.isClassInitializationToBeStubbedOut(); } setUseMockingBridge(classLoader); }
public void testPassesWhenCalledTheExactNumberOfTimes() { proxy.m(); proxy.m(); mock.verify(); }
public void useDynamicMockingForInstanceMethods(MockedType typeMetadata) { ignoreConstructors = typeMetadata == null || typeMetadata.getMaxInstancesToCapture() <= 0; executionMode = 2; }