org.mockito.stubbing
A0
- type of the first argumentA1
- type of the second argumentA2
- type of the third argumentA3
- type of the fourth argument@Incubating public interface VoidAnswer4<A0,A1,A2,A3>
Example of stubbing a mock with this custom answer:
when(mock.someMethod(anyString(), anyInt(), anyString(), anyChar())).thenAnswer(
new Answer<String, Integer, String, Character>() {
void answer(String msg, Integer count, String another, Character c) {
throw new Exception(String.format(msg, another, c, count));
}
});
//Following will raise an exception with the message "ka-boom <3"
mock.someMethod("%s-boom %c%d", 3, "ka", '<');
Answer