public class InterceptedInvocation extends Object implements Invocation, VerificationAwareInvocation
| Modifier and Type | Field and Description |
|---|---|
static RealMethod |
NO_OP |
| Constructor and Description |
|---|
InterceptedInvocation(MockReference<Object> mockRef,
MockitoMethod mockitoMethod,
Object[] arguments,
RealMethod realMethod,
Location location,
int sequenceNumber) |
| Modifier and Type | Method and Description |
|---|---|
Object |
callRealMethod()
calls real method
|
boolean |
equals(Object o) |
<T> T |
getArgument(int index)
Returns casted argument at the given index.
|
<T> T |
getArgument(int index,
Class<T> clazz)
Returns casted argument at the given index.
|
Object[] |
getArguments()
Returns arguments passed to the method.
|
List<ArgumentMatcher> |
getArgumentsAsMatchers()
Wraps each argument using
ArgumentMatchers.eq(Object) or
AdditionalMatchers.aryEq(Object[])
Used internally for the purposes of human-readable invocation printing. |
Location |
getLocation()
The place in the code where the invocation happened.
|
Method |
getMethod()
returns the method
|
Object |
getMock()
returns the mock object
|
MockitoMethod |
getMockitoMethod()
Deprecated.
Not used by Mockito but by mockito-scala
|
MockReference<Object> |
getMockRef()
Deprecated.
Not used by Mockito but by mockito-scala
|
Object[] |
getRawArguments()
Returns unprocessed arguments whereas
InvocationOnMock.getArguments() returns
arguments already processed (e.g. |
Class<?> |
getRawReturnType()
Returns unprocessed arguments whereas
InvocationOnMock.getArguments() returns
arguments already processed (e.g. |
RealMethod |
getRealMethod()
Deprecated.
Not used by Mockito but by mockito-scala
|
int |
getSequenceNumber() |
int |
hashCode() |
void |
ignoreForVerification()
Configures this invocation to be ignored for verify-no-more-invocations or verification in order.
|
boolean |
isIgnoredForVerification()
Informs if the invocation participates in verify-no-more-invocations or verification in order.
|
boolean |
isVerified() |
void |
markStubbed(StubInfo stubInfo)
Marks this invocation as stubbed.
|
void |
markVerified()
Marks this invocation as verified so that it will not cause verification error at
Mockito.verifyNoMoreInteractions(Object...) |
StubInfo |
stubInfo() |
String |
toString()
Describes the invocation in the human friendly way.
|
public static final RealMethod NO_OP
public InterceptedInvocation(MockReference<Object> mockRef, MockitoMethod mockitoMethod, Object[] arguments, RealMethod realMethod, Location location, int sequenceNumber)
public boolean isVerified()
isVerified in interface VerificationAwareInvocationisVerified in interface InvocationMockito.verifyNoMoreInteractions(Object...)public int getSequenceNumber()
getSequenceNumber in interface Invocationpublic Location getLocation()
DescribedInvocationgetLocation in interface DescribedInvocationgetLocation in interface Invocationpublic Object[] getRawArguments()
InvocationInvocationOnMock.getArguments() returns
arguments already processed (e.g. varargs expended, etc.).getRawArguments in interface Invocationpublic Class<?> getRawReturnType()
InvocationInvocationOnMock.getArguments() returns
arguments already processed (e.g. varargs expended, etc.).getRawReturnType in interface Invocationpublic void markVerified()
InvocationMockito.verifyNoMoreInteractions(Object...)markVerified in interface Invocationpublic StubInfo stubInfo()
stubInfo in interface Invocationpublic void markStubbed(StubInfo stubInfo)
InvocationmarkStubbed in interface InvocationstubInfo - the information about stubbing.public boolean isIgnoredForVerification()
InvocationisIgnoredForVerification in interface Invocationpublic void ignoreForVerification()
InvocationInvocation.isIgnoredForVerification()ignoreForVerification in interface Invocationpublic Object getMock()
InvocationOnMockgetMock in interface InvocationOnMockpublic Method getMethod()
InvocationOnMockgetMethod in interface InvocationOnMockpublic Object[] getArguments()
InvocationOnMockgetArguments in interface InvocationOnMockpublic <T> T getArgument(int index)
InvocationOnMockInvocationOnMock.getArguments().
This method is preferred over InvocationOnMock.getArgument(int, Class) for readability. Please read
the documentation of InvocationOnMock.getArgument(int, Class) for an overview of situations when
that method is preferred over this one.getArgument in interface InvocationOnMockindex - argument indexpublic <T> T getArgument(int index,
Class<T> clazz)
InvocationOnMockInvocationOnMock.getArgument(int), but is necessary to circumvent issues when dealing with generics.
In general, InvocationOnMock.getArgument(int) is the appropriate function to use. This particular
function is only necessary if you are doing one of the following things:
InvocationOnMock.getArgument(int).InvocationOnMock.getArgument(int) instead, you can circumvent the compilation
issues by storing the intermediate result into a local variable with the correct type.getArgument in interface InvocationOnMockindex - argument indexclazz - class to cast the argument topublic List<ArgumentMatcher> getArgumentsAsMatchers()
InvocationArgumentMatchers.eq(Object) or
AdditionalMatchers.aryEq(Object[])
Used internally for the purposes of human-readable invocation printing.getArgumentsAsMatchers in interface InvocationArgumentMatcher wrapping each of this invocation argumentspublic Object callRealMethod() throws Throwable
InvocationOnMockWarning: depending on the real implementation it might throw exceptions
callRealMethod in interface InvocationOnMockThrowable - in case real method throws@Deprecated public MockReference<Object> getMockRef()
@Deprecated public MockitoMethod getMockitoMethod()
@Deprecated public RealMethod getRealMethod()
public String toString()
DescribedInvocationtoString in interface DescribedInvocationtoString in class ObjectCopyright © 2025. All rights reserved.