Package org.mockito.invocation
Interface MatchableInvocation
- All Superinterfaces:
DescribedInvocation
MatchableInvocation
wraps Invocation
instance
and holds argument matchers associated with that invocation.
It is used during verification process:
mock.foo(); // <- invocation
verify(mock).bar(); // <- matchable invocation
- Since:
- 2.2.12
-
Method Summary
Modifier and TypeMethodDescriptionvoid
captureArgumentsFrom
(Invocation invocation) This method is used by Mockito to implement argument captor functionality (seeArgumentCaptor
.The actual invocation Mockito will match against.The argument matchers of this invocation.boolean
hasSameMethod
(Invocation candidate) Returns true if the candidate invocation has the same method (method name and parameter types)boolean
hasSimilarMethod
(Invocation candidate) Candidate invocation has the similar method.boolean
matches
(Invocation candidate) Same method, mock and all arguments match.Methods inherited from interface org.mockito.invocation.DescribedInvocation
getLocation, toString
-
Method Details
-
getInvocation
Invocation getInvocation()The actual invocation Mockito will match against.- Since:
- 2.2.12
-
getMatchers
List<ArgumentMatcher> getMatchers()The argument matchers of this invocation. When the invocation is declared without argument matchers (e.g. using plain arguments) Mockito still converts them intoArgumentMatcher
instances that use 'eq' matching viaArgumentMatchers.eq(Object)
.- Since:
- 2.2.12
-
matches
Same method, mock and all arguments match.- Since:
- 2.2.12
-
hasSimilarMethod
Candidate invocation has the similar method. 'Similar' means the same method name, same mock, unverified, not overloaded, but not necessarily matching arguments- Since:
- 2.2.12
-
hasSameMethod
Returns true if the candidate invocation has the same method (method name and parameter types)- Since:
- 2.2.12
-
captureArgumentsFrom
This method is used by Mockito to implement argument captor functionality (seeArgumentCaptor
.Makes this instance of matchable invocation capture all arguments of provided invocation.
- Parameters:
invocation
- the invocation to capture the arguments from- Since:
- 2.2.12
-