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 c210c30d74ed..2cfcb27e7834 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 @@ -29,14 +29,14 @@ * *

Method Signatures

* - *

{@code @AfterAll} methods must not be {@code private} and must be - * {@code static} by default. Consequently, {@code @AfterAll} methods are not + * {@code @AfterAll} methods must have a {@code void} return type, + * must not be {@code private}, and must be {@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}. - * {@code @AfterAll} methods must not return a value. * *

Inheritance

* diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterEach.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterEach.java index 32f4dbedb55a..b7e85a3f24e0 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterEach.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterEach.java @@ -27,10 +27,10 @@ * *

Method Signatures

* - *

{@code @AfterEach} methods must not be {@code private}, must not be - * {@code static}, and may optionally declare parameters to be resolved by + * {@code @AfterEach} methods must have a {@code void} return type, + * must not be {@code private}, and must not be {@code static}. + * They may optionally declare parameters to be resolved by * {@link org.junit.jupiter.api.extension.ParameterResolver ParameterResolvers}. - * {@code @AfterEach} methods must not return a value. * *

Inheritance

* 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 2243efa24d2d..c309a0962e53 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 @@ -29,14 +29,14 @@ * *

Method Signatures

* - *

{@code @BeforeAll} methods must not be {@code private} and must be - * {@code static} by default. Consequently, {@code @BeforeAll} methods are not + * {@code @BeforeAll} methods must have a {@code void} return type, + * must not be {@code private}, and must be {@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}. - * {@code @BeforeAll} methods must not return a value. * *

Inheritance

* diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeEach.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeEach.java index 052c36154f43..746df6d30f4d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeEach.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeEach.java @@ -27,10 +27,10 @@ * *

Method Signatures

* - *

{@code @BeforeEach} methods must not be {@code private}, must not be - * {@code static}, and may optionally declare parameters to be resolved by + * {@code @BeforeEach} methods must have a {@code void} return type, + * must not be {@code private}, and must not be {@code static}. + * They may optionally declare parameters to be resolved by * {@link org.junit.jupiter.api.extension.ParameterResolver ParameterResolvers}. - * {@code @BeforeEach} methods must not return a value. * *

Inheritance

* diff --git a/junit-jupiter-engine/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java b/junit-jupiter-engine/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java index 0c74cbcca979..a2e3a84367b2 100644 --- a/junit-jupiter-engine/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java +++ b/junit-jupiter-engine/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java @@ -10,7 +10,7 @@ package org.junit.jupiter.engine; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.RepeatedTest; import org.junit.jupiter.api.Test; @@ -21,24 +21,21 @@ class NonVoidTestableMethodIntegrationTests { void valid() { } - //this method must never be called @Test int invalidMethodReturningPrimitive() { - assertTrue(false); + fail("This method should never have been called."); return 1; } - //this method must never be called @Test String invalidMethodReturningObject() { - assertTrue(false); + fail("This method should never have been called."); return ""; } - //this method must never be called @RepeatedTest(3) int invalidMethodVerifyingTestTemplateMethod() { - assertTrue(false); + fail("This method should never have been called."); return 1; }