I have a JUnit class with different methods to perform different tests.
I use Mockito to create a spy on real instance, and then ov
As per the documentation, we have
reset(mock);
//at this point the mock forgot any interactions & stubbing
The documentation specifies further
Normally, you don't need to reset your mocks, just create new mocks for each test method. Instead of #reset() please consider writing simple, small and focused test methods over lengthy, over-specified tests.
Here's an example from their github repo which tests this behavior and uses it:
@Test
public void shouldRemoveAllInteractions() throws Exception {
mock.simpleMethod(1);
reset(mock);
verifyZeroInteractions(mock);
}
reference : ResetTest.java