Package org.mockito.verification
Interface VerificationMode
-
- All Known Subinterfaces:
VerificationAfterDelay,VerificationWithTimeout
- All Known Implementing Classes:
After,Timeout,org.mockito.internal.verification.VerificationWrapper
public interface VerificationModeAllows verifying that certain behavior happened at least once / exact number of times / never. E.g:
times(1) is the default and can be omittedverify(mock, times(5)).someMethod("was called five times"); verify(mock, never()).someMethod("was never called"); verify(mock, atLeastOnce()).someMethod("was called at least once"); verify(mock, atLeast(2)).someMethod("was called at least twice"); verify(mock, atMost(3)).someMethod("was called at most 3 times");See examples in javadoc for
Mockito.verify(Object, VerificationMode)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default VerificationModedescription(String description)Description will be prepended to the assertion error if verification fails.voidverify(org.mockito.internal.verification.api.VerificationData data)Performs the verification
-
-
-
Method Detail
-
verify
void verify(org.mockito.internal.verification.api.VerificationData data)
Performs the verification
-
description
default VerificationMode description(String description)
Description will be prepended to the assertion error if verification fails.- Parameters:
description- The custom failure message- Returns:
- VerificationMode
- Since:
- 2.1.0
-
-