24
I've got a save() method that returns void:
public void save( MyThing ) throws SaveFailureException { ... }
The call to save() has retry logic to handle the exception. I want to test it by mocking out the first call to save() so that it throws an exception, and the second call should succeed without an exception.
Mockito has a nice way to handle successive behavior for non-void methods, e.g.:
when( mock.save() ).thenThrow( ... ).thenReturn( ... )
How can I do the same with methods that return void?