@Test(expected = UnexpectedInvocation.class) public void verifyAllInvocationsToSubclassMethods_whenNotVerified(final SubDependency mock2) { mock.prepare(); mock2.getValue(); new FullVerificationsInOrder(1, mock2.getClass()) { { mock.prepare(); } }; }
@Test public void verifyAllInvocationsToSubclassMethods(final SubDependency mock2) { mock.prepare(); mock2.getValue(); new FullVerifications(1, mock2.getClass()) { { mock2.getValue(); } }; }
@Test(expected = UnexpectedInvocation.class) public void verifyAllInvocationsToMethodsOfBaseClassAndOfSubclass_whenSubclassMethodNotVerified( final SubDependency mock2) { mock.prepare(); mock2.getValue(); new FullVerifications(mock2) { { mock.prepare(); } }; }
@Test public void verifyAllInvocationsToInheritedMethods(SubDependency mock2) { mock.prepare(); mock2.getValue(); new FullVerificationsInOrder(1, mock) { { mock.prepare(); } }; new FullVerificationsInOrder(Dependency.class) { { mock.prepare(); } }; }
@Test public void verifyNoInvocationsOnOneOfTwoMockedDependenciesBeyondThoseRecordedAsExpected( final AnotherDependency mock2) { new NonStrictExpectations() { { mock.setSomething(anyInt); minTimes = 1; mock2.doSomething(); times = 1; } }; mock.prepare(); mock.setSomething(1); mock.setSomething(2); mock.save(); mock2.doSomething(); new FullVerifications(mock2) {}; }
private void exerciseCodeUnderTest() { mock.prepare(); mock.setSomething(123); mock.editABunchMoreStuff(); mock.save(); }