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