org.mockito.stubbing
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:
when(mock.someMethod(anyInt(), anyString(), anyChar())).thenAnswer(
new Answer<StringBuilder, Integer, String, Character>() {
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