Java Code Examples for org.mockito.invocation.Invocation#markVerified()

The following examples show how to use org.mockito.invocation.Invocation#markVerified() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InvocationBuilder.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Build the invocation
 *
 * If the method was not specified, use IMethods methods.
 *
 * @return invocation
 */
public Invocation toInvocation() {
    if (method == null) {
        if (argTypes == null) {
            argTypes = new LinkedList<Class<?>>();
            for (Object arg : args) {
                if (arg == null) {
                    argTypes.add(Object.class);
                } else {
                    argTypes.add(arg.getClass());
                }
            }
        }

        try {
            method = IMethods.class.getMethod(methodName, argTypes.toArray(new Class[argTypes.size()]));
        } catch (Exception e) {
            throw new RuntimeException("builder only creates invocations of IMethods interface", e);
        }
    }
    
    Invocation i = new InvocationImpl(mock, new SerializableMethod(method), args, sequenceNumber, null);
    if (verified) {
        i.markVerified();
    }
    return i;
}
 
Example 2
Source File: ArgumentsExtractorVerifier.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void verify(final VerificationData data) {
    List<Invocation> actualInvocations =
        InvocationsFinder.findInvocations(data.getAllInvocations(), data.getTarget());
    if (actualInvocations.size() != 1) {
        throw new MockitoException("This verifier can only be used with 1 invocation, got "
                + actualInvocations.size());
    }
    Invocation invocation = actualInvocations.get(0);
    arguments = invocation.getArguments();
    invocation.markVerified();
}
 
Example 3
Source File: InvocationMarker.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void markVerified(Invocation invocation, CapturesArgumensFromInvocation wanted) {
	invocation.markVerified();
	wanted.captureArgumentsFrom(invocation);
}