1 /*
2 * MIT License
3 * Copyright (c) 2006-2025 JMockit developers
4 * See LICENSE file for full license text.
5 */
6 package mockit;
7
8 import edu.umd.cs.findbugs.annotations.NonNull;
9
10 /**
11 * Same as {@link Verifications}, but checking that <em>all</em> invocations from code under test are explicitly
12 * verified, except for those already verified through other means.
13 *
14 * <pre>{@code
15 * // Exercise tested code.
16 * codeUnderTest.doSomething();
17 *
18 * // Now verify that expected invocations occurred in any order, with no invocations left unverified.
19 * new FullVerifications() {{
20 * <strong>mock1</strong>.expectedMethod(anyInt);
21 * <strong>mock2</strong>.anotherExpectedMethod(1, "test"); times = 2;
22 * }};
23 * }</pre>
24 *
25 * Any invocation from code under test that is not covered by an explicit verification, or by an invocation count
26 * constraint when recorded, will cause an assertion error to be thrown.
27 *
28 * @see #FullVerifications()
29 * @see #FullVerifications(Object...)
30 * @see <a href="http://jmockit.github.io/tutorial/Mocking.html#fullVerification" target="tutorial">Tutorial</a>
31 */
32 public class FullVerifications extends Verifications {
33 /**
34 * Begins <em>full</em> verification on the mocked types/instances that can potentially be invoked from code under
35 * test.
36 *
37 * @see #FullVerifications(Object...)
38 */
39 protected FullVerifications() {
40 super(false);
41 }
42
43 /**
44 * Same as {@link #FullVerifications()}, but restricting the verification to the specified mocked types and/or
45 * mocked instances.
46 *
47 * @param mockedTypesAndInstancesToVerify
48 * one or more of the mocked types (ie, <code>Class</code> objects) and/or mocked instances that are in
49 * scope for the test; for a given mocked <em>instance</em>, all classes up to (but not including)
50 * <code>java.lang.Object</code> are considered
51 */
52 protected FullVerifications(@NonNull Object... mockedTypesAndInstancesToVerify) {
53 super(false, mockedTypesAndInstancesToVerify);
54 }
55 }