Package org.mockito.internal.invocation
Class InvocationMatcher
java.lang.Object
org.mockito.internal.invocation.InvocationMatcher
- All Implemented Interfaces:
Serializable,DescribedInvocation,MatchableInvocation
- Direct Known Subclasses:
StubbedInvocationMatcher
public class InvocationMatcher
extends Object
implements MatchableInvocation, DescribedInvocation, Serializable
In addition to all content of the invocation, the invocation matcher contains the argument matchers. Invocation matcher is used during verification and stubbing. In those cases, the user can provide argument matchers instead of 'raw' arguments. Raw arguments are converted to 'equals' matchers anyway.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInvocationMatcher(Invocation invocation) InvocationMatcher(Invocation invocation, List<ArgumentMatcher> matchers) -
Method Summary
Modifier and TypeMethodDescriptionvoidcaptureArgumentsFrom(Invocation invocation) This method is used by Mockito to implement argument captor functionality (seeArgumentCaptor.static List<InvocationMatcher> createFrom(List<Invocation> invocations) The actual invocation Mockito will match against.The place in the code where the invocation happened.The argument matchers of this invocation.booleanhasSameMethod(Invocation candidate) Returns true if the candidate invocation has the same method (method name and parameter types)booleanhasSimilarMethod(Invocation candidate) similar means the same method name, same mock, unverified and: if arguments are the same cannot be overloadedbooleanmatches(Invocation candidate) Same method, mock and all arguments match.toString()Describes the invocation in the human friendly way.
-
Constructor Details
-
InvocationMatcher
-
InvocationMatcher
-
-
Method Details
-
createFrom
-
getMethod
-
getInvocation
Description copied from interface:MatchableInvocationThe actual invocation Mockito will match against.- Specified by:
getInvocationin interfaceMatchableInvocation
-
getMatchers
Description copied from interface:MatchableInvocationThe argument matchers of this invocation. When the invocation is declared without argument matchers (e.g. using plain arguments) Mockito still converts them intoArgumentMatcherinstances that use 'eq' matching viaArgumentMatchers.eq(Object).- Specified by:
getMatchersin interfaceMatchableInvocation
-
toString
Description copied from interface:DescribedInvocationDescribes the invocation in the human friendly way.- Specified by:
toStringin interfaceDescribedInvocation- Overrides:
toStringin classObject- Returns:
- the description of this invocation.
-
matches
Description copied from interface:MatchableInvocationSame method, mock and all arguments match.- Specified by:
matchesin interfaceMatchableInvocation
-
hasSimilarMethod
similar means the same method name, same mock, unverified and: if arguments are the same cannot be overloaded- Specified by:
hasSimilarMethodin interfaceMatchableInvocation
-
hasSameMethod
Description copied from interface:MatchableInvocationReturns true if the candidate invocation has the same method (method name and parameter types)- Specified by:
hasSameMethodin interfaceMatchableInvocation
-
getLocation
Description copied from interface:DescribedInvocationThe place in the code where the invocation happened.- Specified by:
getLocationin interfaceDescribedInvocation- Returns:
- the location of the invocation.
-
captureArgumentsFrom
Description copied from interface:MatchableInvocationThis method is used by Mockito to implement argument captor functionality (seeArgumentCaptor.Makes this instance of matchable invocation capture all arguments of provided invocation.
- Specified by:
captureArgumentsFromin interfaceMatchableInvocation- Parameters:
invocation- the invocation to capture the arguments from
-