use of org.mockito.internal.invocation.InvocationBuilder in project mockito by mockito.
the class NoMoreInteractionsTest method shouldVerifyInOrderMultipleInvoctions.
@Test
public void shouldVerifyInOrderMultipleInvoctions() {
//given
NoMoreInteractions n = new NoMoreInteractions();
Invocation i = new InvocationBuilder().seq(1).toInvocation();
Invocation i2 = new InvocationBuilder().seq(2).toInvocation();
//when
context.markVerified(i2);
//then no exception is thrown
n.verifyInOrder(new VerificationDataInOrderImpl(context, asList(i, i2), null));
}
use of org.mockito.internal.invocation.InvocationBuilder in project mockito by mockito.
the class NoMoreInteractionsTest method shouldVerifyInOrderAndPass.
@Test
public void shouldVerifyInOrderAndPass() {
//given
NoMoreInteractions n = new NoMoreInteractions();
Invocation i = new InvocationBuilder().toInvocation();
context.markVerified(i);
assertTrue(context.isVerified(i));
//when
n.verifyInOrder(new VerificationDataInOrderImpl(context, asList(i), null));
//then no exception is thrown
}
use of org.mockito.internal.invocation.InvocationBuilder 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.invocation.InvocationBuilder in project mockito by mockito.
the class NoMoreInteractionsTest method shouldVerifyInOrderMultipleInvoctionsAndThrow.
@Test
public void shouldVerifyInOrderMultipleInvoctionsAndThrow() {
//given
NoMoreInteractions n = new NoMoreInteractions();
Invocation i = new InvocationBuilder().seq(1).toInvocation();
Invocation i2 = new InvocationBuilder().seq(2).toInvocation();
try {
//when
n.verifyInOrder(new VerificationDataInOrderImpl(context, asList(i, i2), null));
fail();
} catch (VerificationInOrderFailure e) {
}
}
use of org.mockito.internal.invocation.InvocationBuilder in project mockito by mockito.
the class OnlyTest method shouldNotMarkAsVerifiedWhenAssertionFailed.
@Test
public void shouldNotMarkAsVerifiedWhenAssertionFailed() {
//given
Invocation invocation = new InvocationBuilder().toInvocation();
assertFalse(invocation.isVerified());
//when
try {
only.verify(new VerificationDataStub(new InvocationBuilder().toInvocationMatcher(), invocation));
fail();
} catch (MockitoAssertionError e) {
}
//then
assertFalse(invocation.isVerified());
}
Aggregations