T
- return typeA0
- type of the first argumentA1
- type of the second argumentA2
- type of the third argument@Incubating public interface Answer3<T,A0,A1,A2>
Example of stubbing a mock with this custom answer:
import static org.mockito.AdditionalAnswers.answer;
when(mock.someMethod(anyInt(), anyString(), anyChar())).then(answer(
new Answer3<StringBuilder, Integer, String, Character>() {
public StringBuilder answer(Integer i, String s, Character c) {
return new StringBuilder().append(i).append(s).append(c);
}
}));
//Following will print "3xyz"
System.out.println(mock.someMethod(3, "xy", 'z'));
Answer
Modifier and Type | Method and Description |
---|---|
T |
answer(A0 argument0,
A1 argument1,
A2 argument2) |