use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class SelectedMocksInOrderVerificationTest method shouldFailVerificationForMockOne.
@Test
public void shouldFailVerificationForMockOne() {
InOrder inOrder = inOrder(mockOne);
inOrder.verify(mockOne).simpleMethod(1);
try {
inOrder.verify(mockOne).differentMethod();
fail();
} catch (VerificationInOrderFailure e) {
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class SelectedMocksInOrderVerificationTest method shouldThrowTooManyInvocationsForMockTwo.
@Test
public void shouldThrowTooManyInvocationsForMockTwo() {
InOrder inOrder = inOrder(mockTwo);
try {
inOrder.verify(mockTwo, times(2)).simpleMethod(2);
fail();
} catch (VerificationInOrderFailure e) {
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class SelectedMocksInOrderVerificationTest method shouldFailVerificationForMockOneBecauseOfWrongOrder.
@Test
public void shouldFailVerificationForMockOneBecauseOfWrongOrder() {
InOrder inOrder = inOrder(mockOne);
inOrder.verify(mockOne).simpleMethod(4);
try {
inOrder.verify(mockOne).simpleMethod(1);
fail();
} catch (VerificationInOrderFailure e) {
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class SelectedMocksInOrderVerificationTest method shouldThrowNoMoreInvocationsForMockTwo.
@Test
public void shouldThrowNoMoreInvocationsForMockTwo() {
InOrder inOrder = inOrder(mockTwo);
try {
inOrder.verify(mockTwo, times(2)).simpleMethod(2);
fail();
} catch (VerificationInOrderFailure e) {
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class NoMoreInteractionsTest method noMoreInteractionsInOrderExceptionMessageShouldDescribeMock.
@Test
public void noMoreInteractionsInOrderExceptionMessageShouldDescribeMock() {
//given
NoMoreInteractions n = new NoMoreInteractions();
IMethods mock = mock(IMethods.class, "a mock");
Invocation i = new InvocationBuilder().mock(mock).toInvocation();
try {
//when
n.verifyInOrder(new VerificationDataInOrderImpl(context, asList(i), null));
//then
fail();
} catch (VerificationInOrderFailure e) {
Assertions.assertThat(e.toString()).contains(mock.toString());
}
}
Aggregations