use of org.mockito.exceptions.verification.VerificationInOrderFailure 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.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class StackTraceFilteringTest method shouldFilterStacktraceWhenVerifyingInOrder.
@Test
public void shouldFilterStacktraceWhenVerifyingInOrder() {
InOrder inOrder = inOrder(mock);
mock.oneArg(true);
mock.oneArg(false);
inOrder.verify(mock).oneArg(false);
try {
inOrder.verify(mock).oneArg(true);
fail();
} catch (VerificationInOrderFailure e) {
Assertions.assertThat(e).has(firstMethodInStackTrace("shouldFilterStacktraceWhenVerifyingInOrder"));
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class FindingRedundantInvocationsInOrderTest method shouldFailToVerifyNoMoreInteractionsInOrder.
@Test
public void shouldFailToVerifyNoMoreInteractionsInOrder() throws Exception {
//when
mock.simpleMethod();
mock.simpleMethod(10);
mock.otherMethod();
//then
InOrder inOrder = inOrder(mock);
inOrder.verify(mock).simpleMethod(10);
try {
inOrder.verifyNoMoreInteractions();
fail();
} catch (VerificationInOrderFailure e) {
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class FindingRedundantInvocationsInOrderTest method shouldFailToVerifyNoMoreInteractionsInOrderWithMultipleMocks.
@Test
public void shouldFailToVerifyNoMoreInteractionsInOrderWithMultipleMocks() throws Exception {
//when
mock.simpleMethod();
mock2.simpleMethod();
mock.otherMethod();
//then
InOrder inOrder = inOrder(mock, mock2);
inOrder.verify(mock2).simpleMethod();
try {
inOrder.verifyNoMoreInteractions();
fail();
} catch (VerificationInOrderFailure e) {
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class SelectedMocksInOrderVerificationTest method shouldThrowTooLittleInvocationsForMockTwo.
@Test
public void shouldThrowTooLittleInvocationsForMockTwo() {
InOrder inOrder = inOrder(mockTwo);
try {
inOrder.verify(mockTwo, times(4)).simpleMethod(2);
fail();
} catch (VerificationInOrderFailure e) {
}
}
Aggregations