public class InvocationMatcher extends java.lang.Object implements MatchableInvocation, DescribedInvocation, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private Invocation |
invocation |
private java.util.List<ArgumentMatcher<?>> |
matchers |
Constructor and Description |
---|
InvocationMatcher(Invocation invocation) |
InvocationMatcher(Invocation invocation,
java.util.List<ArgumentMatcher> matchers) |
Modifier and Type | Method and Description |
---|---|
private boolean |
argumentsMatch(Invocation actual) |
private ArgumentMatcherAction |
captureArgument() |
void |
captureArgumentsFrom(Invocation invocation)
This method is used by Mockito to implement argument captor functionality (see
ArgumentCaptor . |
static java.util.List<InvocationMatcher> |
createFrom(java.util.List<Invocation> invocations) |
Invocation |
getInvocation()
The actual invocation Mockito will match against.
|
Location |
getLocation()
The place in the code where the invocation happened.
|
java.util.List<ArgumentMatcher> |
getMatchers()
The argument matchers of this invocation.
|
java.lang.reflect.Method |
getMethod() |
boolean |
hasSameMethod(Invocation candidate)
Returns true if the candidate invocation has the same method (method name and parameter types)
|
boolean |
hasSimilarMethod(Invocation candidate)
similar means the same method name, same mock, unverified and: if arguments are the same cannot be overloaded
|
boolean |
matches(Invocation candidate)
Same method, mock and all arguments match.
|
java.lang.String |
toString()
Describes the invocation in the human friendly way.
|
private final Invocation invocation
private final java.util.List<ArgumentMatcher<?>> matchers
public InvocationMatcher(Invocation invocation, java.util.List<ArgumentMatcher> matchers)
public InvocationMatcher(Invocation invocation)
public static java.util.List<InvocationMatcher> createFrom(java.util.List<Invocation> invocations)
public java.lang.reflect.Method getMethod()
public Invocation getInvocation()
MatchableInvocation
getInvocation
in interface MatchableInvocation
public java.util.List<ArgumentMatcher> getMatchers()
MatchableInvocation
ArgumentMatcher
instances
that use 'eq' matching via ArgumentMatchers.eq(Object)
.getMatchers
in interface MatchableInvocation
public java.lang.String toString()
DescribedInvocation
toString
in interface DescribedInvocation
toString
in class java.lang.Object
public boolean matches(Invocation candidate)
MatchableInvocation
matches
in interface MatchableInvocation
public boolean hasSimilarMethod(Invocation candidate)
hasSimilarMethod
in interface MatchableInvocation
public boolean hasSameMethod(Invocation candidate)
MatchableInvocation
hasSameMethod
in interface MatchableInvocation
public Location getLocation()
DescribedInvocation
getLocation
in interface DescribedInvocation
public void captureArgumentsFrom(Invocation invocation)
MatchableInvocation
ArgumentCaptor
.
Makes this instance of matchable invocation capture all arguments of provided invocation.
captureArgumentsFrom
in interface MatchableInvocation
invocation
- the invocation to capture the arguments fromprivate ArgumentMatcherAction captureArgument()
private boolean argumentsMatch(Invocation actual)