Interface MatchableInvocation

All Superinterfaces:
DescribedInvocation

public interface MatchableInvocation extends 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 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 into ArgumentMatcher instances that use 'eq' matching via ArgumentMatchers.eq(Object).
      Since:
      2.2.12
    • matches

      boolean matches(Invocation candidate)
      Same method, mock and all arguments match.
      Since:
      2.2.12
    • hasSimilarMethod

      boolean hasSimilarMethod(Invocation candidate)
      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

      boolean hasSameMethod(Invocation candidate)
      Returns true if the candidate invocation has the same method (method name and parameter types)
      Since:
      2.2.12
    • captureArgumentsFrom

      void captureArgumentsFrom(Invocation invocation)
      This method is used by Mockito to implement argument captor functionality (see ArgumentCaptor.

      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