I want to verify if a method is called at least once through mockito verify. I used verify and it complains like this:
org.mockito.exceptions.verification.TooManyActualInvocations: Wanted 1 time: But was 2 times. Undesired invocation:
Using the appropriate 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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With