Resetting mocks
@Test
public void test_Resest(){
ArrayList mock = Mockito.mock(ArrayList.class);
Mockito.when(mock.size()).thenReturn(10);
mock.add(1);
Mockito.reset(mock);
//at this point the mock forgot any interactions & stubbing
Mockito.verify(mock).add(1);
// here it will fail
Assert.assertThat(mock.size(), CoreMatchers.is(10));
// here also it will fail
}
public void test_Resest(){
ArrayList mock = Mockito.mock(ArrayList.class);
Mockito.when(mock.size()).thenReturn(10);
mock.add(1);
Mockito.reset(mock);
//at this point the mock forgot any interactions & stubbing
Mockito.verify(mock).add(1);
// here it will fail
Assert.assertThat(mock.size(), CoreMatchers.is(10));
// here also it will fail
}