Search in sources :

Example 1 with VerificationDataInOrderImpl

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

Example 2 with VerificationDataInOrderImpl

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

Example 3 with VerificationDataInOrderImpl

use of org.mockito.internal.verification.api.VerificationDataInOrderImpl 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) {
    }
}
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)

Example 4 with VerificationDataInOrderImpl

use of org.mockito.internal.verification.api.VerificationDataInOrderImpl in project mockito by mockito.

the class MockitoCore method verifyNoMoreInteractionsInOrder.

public void verifyNoMoreInteractionsInOrder(List<Object> mocks, InOrderContext inOrderContext) {
    mockingProgress().validateState();
    VerificationDataInOrder data = new VerificationDataInOrderImpl(inOrderContext, VerifiableInvocationsFinder.find(mocks), null);
    VerificationModeFactory.noMoreInteractions().verifyInOrder(data);
}
Also used : VerificationDataInOrder(org.mockito.internal.verification.api.VerificationDataInOrder) VerificationDataInOrderImpl(org.mockito.internal.verification.api.VerificationDataInOrderImpl)

Example 5 with VerificationDataInOrderImpl

use of org.mockito.internal.verification.api.VerificationDataInOrderImpl in project mockito by mockito.

the class InOrderWrapper method verify.

public void verify(VerificationData data) {
    List<Invocation> invocations = VerifiableInvocationsFinder.find(inOrder.getMocksToBeVerifiedInOrder());
    VerificationDataInOrderImpl dataInOrder = new VerificationDataInOrderImpl(inOrder, invocations, data.getTarget());
    mode.verifyInOrder(dataInOrder);
}
Also used : Invocation(org.mockito.invocation.Invocation) VerificationDataInOrderImpl(org.mockito.internal.verification.api.VerificationDataInOrderImpl)

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