how to mock a method which returns void code example Example: java doreturn void doNothing().when(yourMock).yourMockedMethod();