mockito官方文档地址: https://www.javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#resetting_mocks
@Test
public void test_resetting() {
//you can enable partial mock capabilities selectively on mocks:
LinkedList mock = mock(LinkedList.class);
when(mock.size()).thenReturn(10);
mock.add(1);
log.info("被mock的size = {}", mock.size()); // print: 被mock的size = 10
// reset重置mock对象的所有mock行为,比如thenReturn这种mock预设
reset(mock);
log.info("reset充值后的size = {}", mock.size()); // print: reset充值后的size = 0
}
end.
标签:ArgumentCaptor,reset,14,--,mockito,log,LinkedList,mock,size From: https://www.cnblogs.com/zhuwenjoyce/p/17508701.html