I can't figure out why the doNothing isn't working for this? Any ideas?
@Captor ArgumentCaptor<GenericClass<someOtherClass>> captor; ... Mockito.doNothing().when(mockObject.methodToStub(captor.capture())); The error is:
Exception: when(java.lang.Void) in Stubber cannot be applied to void
This stub is wrong :
doNothing().when(mockObject.methodToStub(captor.capture())); // wrong methodToStub(...) must be outside the when if using this API style (it should only contain the mock) :
doNothing().when(mockObject).methodToStub(captor.capture()); // correct Tho remarks however :
doNothing is the default for void methods for a mock.BDDMockito aliases that enables your code to be real à la Behavior Driven Development If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With