All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mockito.verification.VerificationMode Maven / Gradle / Ivy

There is a newer version: 5.13.0
Show newest version
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito.verification;

import org.mockito.Mockito;
import org.mockito.internal.verification.VerificationModeFactory;
import org.mockito.internal.verification.api.VerificationData;

/**
 * Allows verifying that certain behavior happened at least once / exact number
 * of times / never. E.g:
 *
 * 

 * verify(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");
 *
 * 
* * times(1) is the default and can be omitted *

* See examples in javadoc for {@link Mockito#verify(Object, VerificationMode)} */ public interface VerificationMode { /** * Performs the verification */ void verify(VerificationData data); /** * Description will be prepended to the assertion error if verification fails. * @param description The custom failure message * @return VerificationMode * @since 2.1.0 */ default VerificationMode description(String description) { return VerificationModeFactory.description(this, description); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy