Package org.mockito.internal.invocation
Class InvocationMatcher
- java.lang.Object
-
- org.mockito.internal.invocation.InvocationMatcher
-
- All Implemented Interfaces:
java.io.Serializable
,PrintableInvocation
,CapturesArgumensFromInvocation
,DescribedInvocation
- Direct Known Subclasses:
StubbedInvocationMatcher
public class InvocationMatcher extends java.lang.Object implements DescribedInvocation, CapturesArgumensFromInvocation, java.io.Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InvocationMatcher(Invocation invocation)
InvocationMatcher(Invocation invocation, java.util.List<org.hamcrest.Matcher> matchers)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
captureArgumentsFrom(Invocation invocation)
static java.util.List<InvocationMatcher>
createFrom(java.util.List<Invocation> invocations)
Invocation
getInvocation()
Location
getLocation()
The place in the code where the invocation happened.java.util.List<org.hamcrest.Matcher>
getMatchers()
java.lang.reflect.Method
getMethod()
boolean
hasSameMethod(Invocation candidate)
boolean
hasSimilarMethod(Invocation candidate)
similar means the same method name, same mock, unverified and: if arguments are the same cannot be overloadedboolean
matches(Invocation actual)
java.lang.String
toString()
Describes the invocation in the human friendly way.
-
-
-
Constructor Detail
-
InvocationMatcher
public InvocationMatcher(Invocation invocation, java.util.List<org.hamcrest.Matcher> matchers)
-
InvocationMatcher
public InvocationMatcher(Invocation invocation)
-
-
Method Detail
-
getMethod
public java.lang.reflect.Method getMethod()
-
getInvocation
public Invocation getInvocation()
-
getMatchers
public java.util.List<org.hamcrest.Matcher> getMatchers()
-
toString
public java.lang.String toString()
Description copied from interface:DescribedInvocation
Describes the invocation in the human friendly way.- Specified by:
toString
in interfaceDescribedInvocation
- Specified by:
toString
in interfacePrintableInvocation
- Overrides:
toString
in classjava.lang.Object
- Returns:
- the description of this invocation.
-
matches
public boolean matches(Invocation actual)
-
hasSimilarMethod
public boolean hasSimilarMethod(Invocation candidate)
similar means the same method name, same mock, unverified and: if arguments are the same cannot be overloaded
-
hasSameMethod
public boolean hasSameMethod(Invocation candidate)
-
getLocation
public Location getLocation()
Description copied from interface:DescribedInvocation
The place in the code where the invocation happened.- Specified by:
getLocation
in interfaceDescribedInvocation
- Specified by:
getLocation
in interfacePrintableInvocation
- Returns:
- the location of the invocation.
-
captureArgumentsFrom
public void captureArgumentsFrom(Invocation invocation)
- Specified by:
captureArgumentsFrom
in interfaceCapturesArgumensFromInvocation
-
createFrom
public static java.util.List<InvocationMatcher> createFrom(java.util.List<Invocation> invocations)
-
-