T
- return typeA0
- type of the single argument@Incubating public interface Answer1<T,A0>
Example of stubbing a mock with this custom answer:
import static org.mockito.AdditionalAnswers.answer;
when(mock.someMethod(anyString())).then(answer(
new Answer1<Integer, String>() {
public Integer answer(String arg) {
return arg.length();
}
}));
//Following will print "3"
System.out.println(mock.someMethod("foo"));
Answer
Modifier and Type | Method and Description |
---|---|
T |
answer(A0 argument0) |