use of org.mockito.stubbing.VoidAnswer3 in project mockito by mockito.
the class StubbingWithAdditionalAnswersTest method will_execute_a_void_based_on_strongly_typed_three_parameter_function.
@Test
public void will_execute_a_void_based_on_strongly_typed_three_parameter_function() throws Exception {
final IMethods target = mock(IMethods.class);
given(iMethods.threeArgumentMethodWithStrings(anyInt(), anyString(), anyString())).will(answerVoid(new VoidAnswer3<Integer, String, String>() {
public void answer(Integer i, String s1, String s2) {
target.threeArgumentMethodWithStrings(i, s1, s2);
}
}));
// invoke on iMethods
iMethods.threeArgumentMethodWithStrings(1, "string1", "string2");
// expect the answer to write correctly to "target"
verify(target, times(1)).threeArgumentMethodWithStrings(1, "string1", "string2");
}
Aggregations