下面列出了org.mockito.invocation.Invocation#markVerified ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 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;
}
@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();
}
public void markVerified(Invocation invocation, CapturesArgumensFromInvocation wanted) {
invocation.markVerified();
wanted.captureArgumentsFrom(invocation);
}