use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class NoMoreInteractionsTest method shouldVerifyInOrder.
@Test
public void shouldVerifyInOrder() {
//given
NoMoreInteractions n = new NoMoreInteractions();
Invocation i = new InvocationBuilder().toInvocation();
assertFalse(context.isVerified(i));
try {
//when
n.verifyInOrder(new VerificationDataInOrderImpl(context, asList(i), null));
//then
fail();
} catch (VerificationInOrderFailure e) {
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class BDDMockitoTest method should_fail_for_interactions_that_were_in_wrong_order.
@Test
public void should_fail_for_interactions_that_were_in_wrong_order() {
InOrder inOrder = inOrder(mock);
mock.arrayReturningMethod();
mock.booleanObjectReturningMethod();
then(mock).should(inOrder).booleanObjectReturningMethod();
try {
then(mock).should(inOrder).arrayReturningMethod();
fail("should have raise in order verification failure on second verify call");
} catch (VerificationInOrderFailure expected) {
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class SpyingOnRealObjectsTest method shouldVerifyInOrderAndFail.
@Test
public void shouldVerifyInOrderAndFail() {
spy.add("one");
spy.add("two");
InOrder inOrder = inOrder(spy);
inOrder.verify(spy).add("two");
try {
inOrder.verify(spy).add("one");
fail();
} catch (VerificationInOrderFailure f) {
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class FindingRedundantInvocationsInOrderTest method shouldSayNoInteractionsWanted.
@Test
public void shouldSayNoInteractionsWanted() throws Exception {
//when
mock.simpleMethod();
//then
InOrder inOrder = inOrder(mock);
try {
inOrder.verifyNoMoreInteractions();
fail();
} catch (VerificationInOrderFailure e) {
assertThat(e).hasMessageContaining("No interactions wanted");
}
}
use of org.mockito.exceptions.verification.VerificationInOrderFailure in project mockito by mockito.
the class SelectedMocksInOrderVerificationTest method shouldFailVerificationForMockTwo.
@Test
public void shouldFailVerificationForMockTwo() {
InOrder inOrder = inOrder(mockTwo);
try {
inOrder.verify(mockTwo).simpleMethod(2);
fail();
} catch (VerificationInOrderFailure e) {
}
}
Aggregations