Debian Codegraph @

junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepetitionInfo.java

raw symbols SCIP
1 /*
2 * Copyright 2015-2024 the original author or authors.
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v2.0 which
6 * accompanies this distribution and is available at
7 *
8 * https://www.eclipse.org/legal/epl-v20.html
9 */
10
11 package org.junit.jupiter.api;
12
13 import static org.apiguardian.api.API.Status.EXPERIMENTAL;
14 import static org.apiguardian.api.API.Status.STABLE;
15
16 import org.apiguardian.api.API;
17
18 /**
19 * {@code RepetitionInfo} is used to inject information about the current
20 * repetition of a repeated test into {@code @RepeatedTest}, {@code @BeforeEach},
21 * and {@code @AfterEach} methods.
22 *
23 * <p>If a method parameter is of type {@code RepetitionInfo}, JUnit will
24 * supply an instance of {@code RepetitionInfo} corresponding to the current
25 * repeated test as the value for the parameter.
26 *
27 * <p><strong>WARNING</strong>: {@code RepetitionInfo} cannot be injected into
28 * a {@code @BeforeEach} or {@code @AfterEach} method if the corresponding test
29 * method is not a {@code @RepeatedTest}. Any attempt to do so will result in a
30 * {@link org.junit.jupiter.api.extension.ParameterResolutionException
31 * ParameterResolutionException}.
32 *
33 * @since 5.0
34 * @see RepeatedTest
35 * @see TestInfo
36 */
37 @API(status = STABLE, since = "5.0")
38 public interface RepetitionInfo {
39
40 /**
41 * Get the current repetition of the corresponding
42 * {@link RepeatedTest @RepeatedTest} method.
43 */
44 int getCurrentRepetition();
45
46 /**
47 * Get the total number of repetitions of the corresponding
48 * {@link RepeatedTest @RepeatedTest} method.
49 *
50 * @see RepeatedTest#value
51 */
52 int getTotalRepetitions();
53
54 /**
55 * Get the current number of repetitions of the corresponding
56 * {@link RepeatedTest @RepeatedTest} method that have ended in a failure.
57 *
58 * @since 5.10
59 * @see #getFailureThreshold()
60 */
61 @API(status = EXPERIMENTAL, since = "5.10")
62 int getFailureCount();
63
64 /**
65 * Get the configured failure threshold of the corresponding
66 * {@link RepeatedTest @RepeatedTest} method.
67 *
68 * @since 5.10
69 * @see RepeatedTest#failureThreshold()
70 */
71 @API(status = EXPERIMENTAL, since = "5.10")
72 int getFailureThreshold();
73
74 }