Search in sources :

Example 6 with VerificationDataInOrderImpl

use of org.mockito.internal.verification.api.VerificationDataInOrderImpl 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());
    }
}
Also used : Invocation(org.mockito.invocation.Invocation) IMethods(org.mockitousage.IMethods) InvocationBuilder(org.mockito.internal.invocation.InvocationBuilder) VerificationDataInOrderImpl(org.mockito.internal.verification.api.VerificationDataInOrderImpl) VerificationInOrderFailure(org.mockito.exceptions.verification.VerificationInOrderFailure) Test(org.junit.Test)

Example 7 with VerificationDataInOrderImpl

use of org.mockito.internal.verification.api.VerificationDataInOrderImpl 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) {
    }
}
Also used : Invocation(org.mockito.invocation.Invocation) InvocationBuilder(org.mockito.internal.invocation.InvocationBuilder) VerificationDataInOrderImpl(org.mockito.internal.verification.api.VerificationDataInOrderImpl) VerificationInOrderFailure(org.mockito.exceptions.verification.VerificationInOrderFailure) Test(org.junit.Test)

Aggregations

VerificationDataInOrderImpl (org.mockito.internal.verification.api.VerificationDataInOrderImpl)7 Invocation (org.mockito.invocation.Invocation)6 Test (org.junit.Test)5 InvocationBuilder (org.mockito.internal.invocation.InvocationBuilder)5 VerificationInOrderFailure (org.mockito.exceptions.verification.VerificationInOrderFailure)3 VerificationDataInOrder (org.mockito.internal.verification.api.VerificationDataInOrder)1 IMethods (org.mockitousage.IMethods)1