Class ReturnsArgumentAt
java.lang.Object
org.mockito.internal.stubbing.answers.ReturnsArgumentAt
- All Implemented Interfaces:
Serializable
,Answer<Object>
Returns the passed parameter identity at specified index.
The argumentIndex
represents the index in the argument array of the invocation.
If this number equals -1 then the last argument is returned.
- Since:
- 1.9.5
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReturnsArgumentAt
(int wantedArgumentPosition) Build the identity answer to return the argument at the given position in the argument array. -
Method Summary
Modifier and TypeMethodDescriptionanswer
(InvocationOnMock invocation) returnedTypeOnSignature
(InvocationOnMock invocation) void
validateIndexWithinInvocationRange
(InvocationOnMock invocation) int
-
Field Details
-
LAST_ARGUMENT
public static final int LAST_ARGUMENT- See Also:
-
-
Constructor Details
-
ReturnsArgumentAt
public ReturnsArgumentAt(int wantedArgumentPosition) Build the identity answer to return the argument at the given position in the argument array.- Parameters:
wantedArgumentPosition
- The position of the argument identity to return in the invocation. Using-1
indicates the last argument.
-
-
Method Details
-
answer
-
wantedArgumentPosition
public int wantedArgumentPosition() -
validateIndexWithinInvocationRange
-
returnedTypeOnSignature
-