All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fitbur.mockito.internal.verification.InOrderWrapper Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package com.fitbur.mockito.internal.verification;

import com.fitbur.mockito.internal.InOrderImpl;
import com.fitbur.mockito.internal.invocation.finder.VerifiableInvocationsFinder;
import com.fitbur.mockito.internal.verification.api.VerificationData;
import com.fitbur.mockito.internal.verification.api.VerificationDataInOrderImpl;
import com.fitbur.mockito.internal.verification.api.VerificationInOrderMode;
import com.fitbur.mockito.invocation.Invocation;
import com.fitbur.mockito.verification.VerificationMode;

import java.util.List;

public class InOrderWrapper implements VerificationMode {

    private final VerificationInOrderMode mode;
    private final InOrderImpl inOrder;

    public InOrderWrapper(VerificationInOrderMode mode, InOrderImpl inOrder) {
        this.mode = mode;
        this.inOrder = inOrder;        
    }

    public void verify(VerificationData data) {
        List invocations = new VerifiableInvocationsFinder().find(inOrder.getMocksToBeVerifiedInOrder());
        VerificationDataInOrderImpl dataInOrder = new VerificationDataInOrderImpl(inOrder, invocations, data.getWanted());
        mode.verifyInOrder(dataInOrder);
    }

    @Override
    public VerificationMode description(String description) {
        return VerificationModeFactory.description(this, description);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy