use of org.mockito.stubbing.VoidAnswer5 in project mockito by mockito.
the class StubbingWithAdditionalAnswersTest method will_execute_a_void_based_on_strongly_typed_five_parameter_function.
@Test
public void will_execute_a_void_based_on_strongly_typed_five_parameter_function() throws Exception {
final IMethods target = mock(IMethods.class);
given(iMethods.simpleMethod(anyString(), anyInt(), anyInt(), anyInt(), anyInt())).will(answerVoid(new VoidAnswer5<String, Integer, Integer, Integer, Integer>() {
public void answer(String s1, Integer i1, Integer i2, Integer i3, Integer i4) {
target.simpleMethod(s1, i1, i2, i3, i4);
}
}));
// invoke on iMethods
iMethods.simpleMethod("hello", 1, 2, 3, 4);
// expect the answer to write correctly to "target"
verify(target, times(1)).simpleMethod("hello", 1, 2, 3, 4);
}
Aggregations