mockit.FullVerifications Maven / Gradle / Ivy
/*
* Copyright (c) 2006 JMockit developers
* This file is subject to the terms of the MIT license (see LICENSE.txt).
*/
package mockit;
import edu.umd.cs.findbugs.annotations.NonNull;
/**
* Same as {@link Verifications}, but checking that all invocations from code under test are explicitly
* verified, except for those already verified through other means.
*
* {@code
* // Exercise tested code.
* codeUnderTest.doSomething();
*
* // Now verify that expected invocations occurred in any order, with no invocations left unverified.
* new FullVerifications() {{
* mock1.expectedMethod(anyInt);
* mock2.anotherExpectedMethod(1, "test"); times = 2;
* }};
* }
*
* Any invocation from code under test that is not covered by an explicit verification, or by an invocation count
* constraint when recorded, will cause an assertion error to be thrown.
*
* @see #FullVerifications()
* @see #FullVerifications(Object...)
* @see Tutorial
*/
public class FullVerifications extends Verifications {
/**
* Begins full verification on the mocked types/instances that can potentially be invoked from code under
* test.
*
* @see #FullVerifications(Object...)
*/
protected FullVerifications() {
super(false);
}
/**
* Same as {@link #FullVerifications()}, but restricting the verification to the specified mocked types and/or
* mocked instances.
*
* @param mockedTypesAndInstancesToVerify
* one or more of the mocked types (ie, Class
objects) and/or mocked instances that are in
* scope for the test; for a given mocked instance, all classes up to (but not including)
* java.lang.Object
are considered
*/
protected FullVerifications(@NonNull Object... mockedTypesAndInstancesToVerify) {
super(false, mockedTypesAndInstancesToVerify);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy