org.mockito.internal.stubbing.answers.ReturnsArgumentAt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockito-core Show documentation
Show all versions of mockito-core Show documentation
Mockito mock objects library core API and implementation
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.stubbing.answers;
import static org.mockito.internal.exceptions.Reporter.invalidArgumentPositionRangeAtInvocationTime;
import static org.mockito.internal.exceptions.Reporter.invalidArgumentRangeAtIdentityAnswerCreationTime;
import static org.mockito.internal.exceptions.Reporter.wrongTypeOfArgumentToReturn;
import java.io.Serializable;
import java.lang.reflect.Method;
import org.mockito.invocation.Invocation;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.mockito.stubbing.ValidableAnswer;
/**
* 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.
*
*
* @see org.mockito.AdditionalAnswers
* @since 1.9.5
*/
public class ReturnsArgumentAt implements Answer