Skip to content

Commit 1c69229

Browse files
committed
Polish JavaDoc for Jupiter programming model APIs
1 parent 6e14025 commit 1c69229

File tree

6 files changed

+54
-18
lines changed

6 files changed

+54
-18
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222

2323
/**
2424
* {@code @AfterEach} is used to signal that the annotated method should be
25-
* executed <em>after</em> <strong>each</strong> {@code @Test} method in
26-
* the current test class.
25+
* executed <em>after</em> <strong>each</strong> {@code @Test},
26+
* {@code @RepeatedTest}, {@code @ParameterizedTest}, {@code @TestFactory},
27+
* and {@code @TestTemplate} method in the current test class.
2728
*
2829
* <h3>Method Signatures</h3>
2930
*
@@ -54,6 +55,9 @@
5455
* @see BeforeAll
5556
* @see AfterAll
5657
* @see Test
58+
* @see RepeatedTest
59+
* @see TestFactory
60+
* @see TestTemplate
5761
*/
5862
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
5963
@Retention(RetentionPolicy.RUNTIME)

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222

2323
/**
2424
* {@code @BeforeEach} is used to signal that the annotated method should be
25-
* executed <em>before</em> <strong>each</strong> {@code @Test} method in
26-
* the current test class.
25+
* executed <em>before</em> <strong>each</strong> {@code @Test},
26+
* {@code @RepeatedTest}, {@code @ParameterizedTest}, {@code @TestFactory},
27+
* and {@code @TestTemplate} method in the current test class.
2728
*
2829
* <h3>Method Signatures</h3>
2930
*
@@ -54,6 +55,9 @@
5455
* @see BeforeAll
5556
* @see AfterAll
5657
* @see Test
58+
* @see RepeatedTest
59+
* @see TestFactory
60+
* @see TestTemplate
5761
*/
5862
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
5963
@Retention(RetentionPolicy.RUNTIME)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@
2424
* {@code @Disabled} is used to signal that the annotated test class or
2525
* test method is currently <em>disabled</em> and should not be executed.
2626
*
27+
* <p>{@code @Disabled} may optionally be declared with a {@linkplain #value
28+
* reason} to document why the annotated test class or test method is disabled.
29+
*
2730
* <p>When applied at the class level, all test methods within that class
2831
* are automatically disabled as well.
2932
*
3033
* @since 5.0
34+
* @see #value
3135
* @see org.junit.jupiter.api.condition.EnabledIf
3236
* @see org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable
3337
* @see org.junit.jupiter.api.condition.EnabledIfSystemProperty

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222

2323
/**
2424
* {@code @Nested} is used to signal that the annotated class is a nested,
25-
* non-static test class.
25+
* non-static test class (i.e., an <em>inner class</em>).
2626
*
2727
* @since 5.0
28+
* @see Test
29+
* @see TestInstance
2830
*/
2931
@Target(ElementType.TYPE)
3032
@Retention(RetentionPolicy.RUNTIME)

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,22 @@
2020

2121
/**
2222
* {@code TestInfo} is used to inject information about the current test or
23-
* container into to {@code @Test}, {@code @BeforeEach}, {@code @AfterEach},
24-
* {@code @BeforeAll}, and {@code @AfterAll} methods.
23+
* container into to {@code @Test}, {@code @RepeatedTest},
24+
* {@code @ParameterizedTest}, {@code @TestFactory}, {@code @BeforeEach},
25+
* {@code @AfterEach}, {@code @BeforeAll}, and {@code @AfterAll} methods.
2526
*
2627
* <p>If a method parameter is of type {@link TestInfo}, JUnit will supply
27-
* an instance of {@code TestInfo} corresponding to the current test as the
28-
* value for the parameter.
28+
* an instance of {@code TestInfo} corresponding to the current test or
29+
* container as the value for the parameter.
2930
*
3031
* @since 5.0
3132
* @see Test
33+
* @see RepeatedTest
34+
* @see TestFactory
35+
* @see BeforeEach
36+
* @see AfterEach
37+
* @see BeforeAll
38+
* @see AfterAll
3239
* @see DisplayName
3340
* @see Tag
3441
*/
@@ -96,7 +103,7 @@ public interface TestInfo {
96103
Optional<Class<?>> getTestClass();
97104

98105
/**
99-
* Get the {@link Method} associated with the current test, if available.
106+
* Get the {@link Method} associated with the current test or container, if available.
100107
*/
101108
Optional<Method> getTestMethod();
102109

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,41 @@
1818
import org.apiguardian.api.API;
1919

2020
/**
21-
* Parameters of type {@code TestReporter} can be injected into methods of
22-
* test classes annotated with {@link BeforeEach @BeforeEach},
23-
* {@link AfterEach @AfterEach}, and {@link Test @Test}.
21+
* Parameters of type {@code TestReporter} can be injected into
22+
* {@link BeforeEach @BeforeEach} and {@link AfterEach @AfterEach} lifecycle
23+
* methods as well as methods annotated with {@link Test @Test},
24+
* {@link RepeatedTest @RepeatedTest},
25+
* {@link org.junit.jupiter.params.ParameterizedTest @ParameterizedTest},
26+
* {@link TestFactory @TestFactory}, etc.
2427
*
25-
* <p>Within such methods this instance of type {@code TestReporter} can be
26-
* used to publish report entries.
28+
* <p>Within such methods the injected {@code TestReporter} can be used to
29+
* publish report entries.
2730
*
2831
* @since 5.0
32+
* @see #publishEntry(Map)
33+
* @see #publishEntry(String, String)
2934
*/
3035
@FunctionalInterface
3136
@API(status = STABLE, since = "5.0")
3237
public interface TestReporter {
3338

3439
/**
35-
* Publish the supplied values as a report entry.
40+
* Publish the supplied map of key-value pairs as a report entry.
3641
*
37-
* @param values the map to be published for this entry
42+
* @param map the key-value pairs to be published; never {@code null};
43+
* keys and values within entries in the map also must not be
44+
* {@code null} or blank
45+
* @see #publishEntry(String, String)
3846
*/
39-
void publishEntry(Map<String, String> values);
47+
void publishEntry(Map<String, String> map);
4048

49+
/**
50+
* Publish the supplied key-value pair as a report entry.
51+
*
52+
* @param key the key of the entry to publish
53+
* @param value the value of the entry to publish
54+
* @see #publishEntry(Map)
55+
*/
4156
default void publishEntry(String key, String value) {
4257
this.publishEntry(Collections.singletonMap(key, value));
4358
}

0 commit comments

Comments
 (0)