|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface VerificationWithTimeout
VerificationWithTimeout is a VerificationMode that allows combining existing verification modes with 'timeout'. E.g:
verify(mock, timeout(100).times(5)).foo(); verify(mock, timeout(100).never()).bar(); verify(mock, timeout(200).atLeastOnce()).baz();
See examples in javadoc for Mockito.verify(Object, VerificationMode)
| Method Summary | |
|---|---|
VerificationMode |
atLeast(int minNumberOfInvocations)
Allows at-least-x verification withing given timeout. |
VerificationMode |
atLeastOnce()
Allows at-least-once verification withing given timeout. |
VerificationMode |
atMost(int maxNumberOfInvocations)
Allows at-most-x verification within given timeout. |
VerificationMode |
never()
Alias to times(0), see times(int) |
VerificationMode |
only()
Allows checking if given method was the only one invoked. |
VerificationMode |
times(int wantedNumberOfInvocations)
Allows verifying exact number of invocations within given timeout |
| Methods inherited from interface org.mockito.verification.VerificationMode |
|---|
verify |
| Method Detail |
|---|
VerificationMode times(int wantedNumberOfInvocations)
verify(mock, timeout(100).times(2)).someMethod("some arg");
See examples in javadoc for Mockito class
wantedNumberOfInvocations - wanted number of invocations
VerificationMode never()
times(int)
Verifies that interaction did not happen within given timeout. E.g:
verify(mock, timeout(100).never()).someMethod();
If you want to verify there were NO interactions with the mock
check out Mockito.verifyNoMoreInteractions(Object...)
See examples in javadoc for Mockito class
VerificationMode atLeastOnce()
verify(mock, timeout(100).atLeastOnce()).someMethod("some arg");
Alias to atLeast(1)
See examples in javadoc for Mockito class
VerificationMode atLeast(int minNumberOfInvocations)
verify(mock, timeout(100).atLeast(3)).someMethod("some arg");
See examples in javadoc for Mockito class
minNumberOfInvocations - minimum number of invocations
VerificationMode atMost(int maxNumberOfInvocations)
verify(mock, timeout(100).atMost(3)).someMethod("some arg");
See examples in javadoc for Mockito class
maxNumberOfInvocations - max number of invocations
VerificationMode only()
verify(mock, only()).someMethod(); //above is a shorthand for following 2 lines of code: verify(mock).someMethod(); verifyNoMoreInvocations(mock);
See also Mockito.verifyNoMoreInteractions(Object...)
See examples in javadoc for Mockito class
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||