A0
- type of the single argument@Incubating public interface VoidAnswer1<A0>
Example of stubbing a mock with this custom answer:
import static org.mockito.AdditionalAnswers.answerVoid;
doAnswer(answerVoid(
new VoidAnswer1<String>() {
public void answer(String msg) throws Exception {
throw new Exception(msg);
}
})).when(mock).someMethod(anyString());
//Following will raise an exception with the message "boom"
mock.someMethod("boom");
Answer