Answers:
使用适当的VerificationMode:
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
verify(mockObject, atLeast(2)).someMethod("was called at least twice");
verify(mockObject, times(3)).someMethod("was called exactly three times");
import static org.mockito.Mockito.times;
。通常不建议导入带有“内部”(import static org.mockito.internal.verification.VerificationModeFactory.times;
)的软件包。
Mockito.times(...)
代替VerificationModeFactory.times(...)
静态导入