diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterAll.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterAll.java index bfd810f21264..892a58468446 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterAll.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterAll.java @@ -30,9 +30,11 @@ *

Method Signatures

* *

{@code @AfterAll} methods must not be {@code private} and must be - * {@code static}. Consequently, {@code @AfterAll} methods are not supported - * in {@link Nested @Nested} test classes or as interface default methods. - * {@code @AfterAll} methods may optionally declare parameters to be resolved by + * {@code static} by default. Consequently, {@code @AfterAll} methods are not + * supported in {@link Nested @Nested} test classes or as interface default + * methods unless the test class is annotated with + * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}. {@code @AfterAll} + * methods may optionally declare parameters to be resolved by * {@link org.junit.jupiter.api.extension.ParameterResolver ParameterResolvers}. * *

Inheritance

@@ -52,6 +54,8 @@ * @see BeforeEach * @see AfterEach * @see Test + * @see TestFactory + * @see TestInstance */ @Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeAll.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeAll.java index 7acf44453e36..4ada244a939e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeAll.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeAll.java @@ -30,9 +30,11 @@ *

Method Signatures

* *

{@code @BeforeAll} methods must not be {@code private} and must be - * {@code static}. Consequently, {@code @BeforeAll} methods are not supported - * in {@link Nested @Nested} test classes or as interface default methods. - * {@code @BeforeAll} methods may optionally declare parameters to be resolved by + * {@code static} by default. Consequently, {@code @BeforeAll} methods are not + * supported in {@link Nested @Nested} test classes or as interface default + * methods unless the test class is annotated with + * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}. {@code @BeforeAll} + * methods may optionally declare parameters to be resolved by * {@link org.junit.jupiter.api.extension.ParameterResolver ParameterResolvers}. * *

Inheritance

@@ -52,6 +54,8 @@ * @see BeforeEach * @see AfterEach * @see Test + * @see TestFactory + * @see TestInstance */ @Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME)