@NotExtensible public interface InvocationOnMock extends Serializable
A placeholder for mock, the method that was called and the arguments that were passed.
Modifier and Type | Method and Description |
---|---|
Object |
callRealMethod()
calls real method
|
<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.
|
Method |
getMethod()
returns the method
|
Object |
getMock()
returns the mock object
|
Object getMock()
Method getMethod()
Object[] getArguments()
<T> T getArgument(int index)
getArguments()
.
This method is preferred over getArgument(int, Class)
for readability. Please read
the documentation of getArgument(int, Class)
for an overview of situations when
that method is preferred over this one.index
- argument index<T> T getArgument(int index, Class<T> clazz)
getArgument(int)
, but is necessary to circumvent issues when dealing with generics.
In general, getArgument(int)
is the appropriate function to use. This particular
function is only necessary if you are doing one of the following things:
1. You want to directly invoke a method on the result of getArgument(int)
.
2. You want to directly pas the result of the invocation into a function that accepts a generic parameter.
If you prefer to use getArgument(int)
instead, you can circumvent the compilation
issues by storing the intermediate result into a local variable with the correct type.index
- argument indexclazz
- clazz to cast the argument to