public class Invocation extends Object
Delegate
classes.
With the Mockups API, it can appear in @Mock methods.| Modifier | Constructor and Description |
|---|---|
protected |
Invocation(Object invokedInstance,
Object[] invokedArguments,
int invocationCount)
For internal use only.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getInvocationCount()
Returns the current invocation count.
|
int |
getInvocationIndex()
Returns the index for the current invocation.
|
Object[] |
getInvokedArguments()
Returns the actual argument values passed in the invocation to the mocked method/constructor.
|
<T> T |
getInvokedInstance()
Returns the instance on which the current invocation was made, or
null for a static method
invocation. |
<M extends Member> |
getInvokedMember()
Returns the
Method or Constructor object corresponding to the mocked method or constructor,
respectively. |
<T> T |
proceed(Object... replacementArguments)
Allows execution to proceed into the real implementation of the mocked method/constructor.
|
public final int getInvocationCount()
public final int getInvocationIndex()
getInvocationCount() - 1.public final Object[] getInvokedArguments()
public final <T> T getInvokedInstance()
null for a static method
invocation.public final <M extends Member> M getInvokedMember()
Method or Constructor object corresponding to the mocked method or constructor,
respectively.public final <T> T proceed(Object... replacementArguments)
super" is executed, using the original argument values; replacement arguments are not supported.
If the execution of said code throws an exception or error, it is propagated out to the caller of the mocked
constructor (even in the case of a checked exception).
Contrary to proceeding into a mocked method, it's not possible to actually execute test code inside the delegate
method after proceeding into the real constructor, nor to proceed into it more than once.T - the return type of the mocked methodreplacementArguments - the argument values to be passed to the real method, as replacement for the values
received by the mock method; if those received values should be passed without
replacement, then this method should be called with no valuesUnsupportedOperationException - if attempting to proceed into a mocked method which does not belong to an
injectable mocked type nor to a dynamic
partially mocked type, into a native method, into a mocked constructor while passing replacement
arguments, or into an interface or abstract methodIllegalArgumentException - if replacement arguments were given but they are the same as the invoked
argumentsCopyright © 2006–2016. All rights reserved.