how to test void method in junit code example Example: java doreturn void doNothing().when(yourMock).yourMockedMethod();