use of org.mockito.internal.verification.api.InOrderContext in project mockito by mockito.
the class AtLeastXNumberOfInvocationsCheckerTest method shouldReportTooLittleInvocationsInOrder.
@Test
public void shouldReportTooLittleInvocationsInOrder() {
InOrderContext context = new InOrderContextImpl();
//given
Invocation invocation = new InvocationBuilder().simpleMethod().toInvocation();
Invocation invocationTwo = new InvocationBuilder().differentMethod().toInvocation();
exception.expect(VerificationInOrderFailure.class);
exception.expectMessage("iMethods.simpleMethod()");
exception.expectMessage("Wanted *at least* 2 times");
exception.expectMessage("But was 1 time");
//when
checkAtLeastNumberOfInvocations(asList(invocation, invocationTwo), new InvocationMatcher(invocation), 2, context);
}
use of org.mockito.internal.verification.api.InOrderContext in project mockito by mockito.
the class AtLeastXNumberOfInvocationsCheckerTest method shouldMarkActualInvocationsAsVerifiedInOrder.
@Test
public void shouldMarkActualInvocationsAsVerifiedInOrder() {
InOrderContext context = new InOrderContextImpl();
//given
Invocation invocation = new InvocationBuilder().simpleMethod().toInvocation();
Invocation invocationTwo = new InvocationBuilder().differentMethod().toInvocation();
//when
checkAtLeastNumberOfInvocations(asList(invocation, invocationTwo), new InvocationMatcher(invocation), 1, context);
//then
assertThat(invocation.isVerified()).isTrue();
}
Aggregations