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