Answers for "mockito return void methods"

1

mockito when with void function

ArgumentCaptor<String> valueCapture = ArgumentCaptor.forClass(String.class);
doNothing().when(object).someMethod(string1, valueCapture.capture());
Posted by: Guest on September-28-2021
1

mockito when with void function

doAnswer(invocation -> {

      return null;
    }).when(object).method(any());
Posted by: Guest on September-28-2021

Browse Popular Code Answers by Language