From 0f9870b603467e303573a880bbe5f93f81276f2f Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Fri, 30 May 2025 14:37:05 +0200 Subject: [PATCH] Stop referring to JUnit 5 in documentation Closes gh-34970 --- .../pages/languages/kotlin/spring-projects-in.adoc | 10 +++++----- .../testing/annotations/integration-junit-jupiter.adoc | 4 ++-- .../pages/testing/annotations/integration-meta.adoc | 4 ++-- .../ROOT/pages/testing/testcontext-framework.adoc | 10 +++++----- .../testing/testcontext-framework/support-classes.adoc | 6 +++--- .../test/context/junit/jupiter/DisabledIf.java | 4 ++-- .../context/junit/jupiter/DisabledIfCondition.java | 4 ++-- .../test/context/junit/jupiter/EnabledIf.java | 4 ++-- .../test/context/junit/jupiter/EnabledIfCondition.java | 4 ++-- .../test/context/junit/jupiter/SpringExtension.java | 2 +- .../test/context/junit/jupiter/package-info.java | 2 +- .../test/context/junit/jupiter/web/package-info.java | 2 +- .../context/junit/SpringJUnitJupiterTestSuite.java | 4 ++-- 13 files changed, 30 insertions(+), 30 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc b/framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc index 2a8670de07..90b0d6fb0d 100644 --- a/framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc +++ b/framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc @@ -324,7 +324,7 @@ progresses. == Testing This section addresses testing with the combination of Kotlin and Spring Framework. -The recommended testing framework is https://junit.org/junit5/[JUnit 5] along with +The recommended testing framework is https://junit.org/junit5/[JUnit] along with https://mockk.io/[Mockk] for mocking. NOTE: If you are using Spring Boot, see @@ -335,7 +335,7 @@ NOTE: If you are using Spring Boot, see === Constructor injection As described in the xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-di[dedicated section], -JUnit Jupiter (JUnit 5) allows constructor injection of beans which is pretty useful with Kotlin +JUnit Jupiter allows constructor injection of beans which is pretty useful with Kotlin in order to use `val` instead of `lateinit var`. You can use {spring-framework-api}/test/context/TestConstructor.html[`@TestConstructor(autowireMode = AutowireMode.ALL)`] to enable autowiring for all parameters. @@ -360,7 +360,7 @@ file with a `spring.test.constructor.autowire.mode = all` property. === `PER_CLASS` Lifecycle Kotlin lets you specify meaningful test function names between backticks (```). -With JUnit Jupiter (JUnit 5), Kotlin test classes can use the `@TestInstance(TestInstance.Lifecycle.PER_CLASS)` +With JUnit Jupiter, Kotlin test classes can use the `@TestInstance(TestInstance.Lifecycle.PER_CLASS)` annotation to enable single instantiation of test classes, which allows the use of `@BeforeAll` and `@AfterAll` annotations on non-static methods, which is a good fit for Kotlin. @@ -404,8 +404,8 @@ class IntegrationTests { [[specification-like-tests]] === Specification-like Tests -You can create specification-like tests with JUnit 5 and Kotlin. -The following example shows how to do so: +You can create specification-like tests with Kotlin and JUnit Jupiter's `@Nested` test +class support. The following example shows how to do so: [source,kotlin,indent=0] ---- diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc index 41b16558e1..5ab998f969 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc @@ -2,8 +2,8 @@ = Spring JUnit Jupiter Testing Annotations The following annotations are supported when used in conjunction with the -xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`] and JUnit Jupiter -(that is, the programming model in JUnit 5): +xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`] +and JUnit Jupiter (that is, the programming model in JUnit): * xref:testing/annotations/integration-junit-jupiter.adoc#integration-testing-annotations-junit-jupiter-springjunitconfig[`@SpringJUnitConfig`] * xref:testing/annotations/integration-junit-jupiter.adoc#integration-testing-annotations-junit-jupiter-springjunitwebconfig[`@SpringJUnitWebConfig`] diff --git a/framework-docs/modules/ROOT/pages/testing/annotations/integration-meta.adoc b/framework-docs/modules/ROOT/pages/testing/annotations/integration-meta.adoc index ce2381c7c1..a956a7c7bc 100644 --- a/framework-docs/modules/ROOT/pages/testing/annotations/integration-meta.adoc +++ b/framework-docs/modules/ROOT/pages/testing/annotations/integration-meta.adoc @@ -140,8 +140,8 @@ Kotlin:: ====== If we write tests that use JUnit Jupiter, we can reduce code duplication even further, -since annotations in JUnit 5 can also be used as meta-annotations. Consider the following -example: +since annotations in JUnit Jupiter can also be used as meta-annotations. Consider the +following example: [tabs] ====== diff --git a/framework-docs/modules/ROOT/pages/testing/testcontext-framework.adoc b/framework-docs/modules/ROOT/pages/testing/testcontext-framework.adoc index 0cf24faa9a..13de70cdef 100644 --- a/framework-docs/modules/ROOT/pages/testing/testcontext-framework.adoc +++ b/framework-docs/modules/ROOT/pages/testing/testcontext-framework.adoc @@ -9,11 +9,11 @@ deal of importance on convention over configuration, with reasonable defaults th can override through annotation-based configuration. In addition to generic testing infrastructure, the TestContext framework provides -explicit support for JUnit 4, JUnit Jupiter (AKA JUnit 5), and TestNG. For JUnit 4 and -TestNG, Spring provides `abstract` support classes. Furthermore, Spring provides a custom -JUnit `Runner` and custom JUnit `Rules` for JUnit 4 and a custom `Extension` for JUnit -Jupiter that let you write so-called POJO test classes. POJO test classes are not -required to extend a particular class hierarchy, such as the `abstract` support classes. +explicit support for JUnit Jupiter, JUnit 4, and TestNG. For JUnit 4 and TestNG, Spring +provides `abstract` support classes. Furthermore, Spring provides a custom JUnit `Runner` +and custom JUnit `Rules` for JUnit 4 and a custom `Extension` for JUnit Jupiter that let +you write so-called POJO test classes. POJO test classes are not required to extend a +particular class hierarchy, such as the `abstract` support classes. The following section provides an overview of the internals of the TestContext framework. If you are interested only in using the framework and are not interested in extending it diff --git a/framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc b/framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc index 9fdad623a9..4887172d7e 100644 --- a/framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc +++ b/framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc @@ -9,7 +9,7 @@ in JUnit and TestNG. == SpringExtension for JUnit Jupiter The Spring TestContext Framework offers full integration with the JUnit Jupiter testing -framework, introduced in JUnit 5. By annotating test classes with +framework, originally introduced in JUnit 5. By annotating test classes with `@ExtendWith(SpringExtension.class)`, you can implement standard JUnit Jupiter-based unit and integration tests and simultaneously reap the benefits of the TestContext framework, such as support for loading application contexts, dependency injection of test instances, @@ -72,8 +72,8 @@ Kotlin:: ---- ====== -Since you can also use annotations in JUnit 5 as meta-annotations, Spring provides the -`@SpringJUnitConfig` and `@SpringJUnitWebConfig` composed annotations to simplify the +Since you can also use annotations in JUnit Jupiter as meta-annotations, Spring provides +the `@SpringJUnitConfig` and `@SpringJUnitWebConfig` composed annotations to simplify the configuration of the test `ApplicationContext` and JUnit Jupiter. The following example uses `@SpringJUnitConfig` to reduce the amount of configuration diff --git a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIf.java b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIf.java index 02223b6566..85adb729c0 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIf.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIf.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ import org.springframework.core.annotation.AliasFor; * {@link org.junit.jupiter.api.condition.DisabledOnOs @DisabledOnOs(MAC)} support * in JUnit Jupiter. * - *
Since JUnit 5.7, JUnit Jupiter also has a condition annotation named + *
JUnit Jupiter also has a condition annotation named * {@link org.junit.jupiter.api.condition.DisabledIf @DisabledIf}. Thus, if you * wish to use Spring's {@code @DisabledIf} support make sure you import the * annotation type from the correct package. diff --git a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIfCondition.java b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIfCondition.java index 6c4908eb8b..3549c3e63d 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIfCondition.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIfCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import org.junit.jupiter.api.extension.ExtensionContext; /** * {@code DisabledIfCondition} is an {@link org.junit.jupiter.api.extension.ExecutionCondition} * that supports the {@link DisabledIf @DisabledIf} annotation when using the Spring - * TestContext Framework in conjunction with JUnit 5's Jupiter programming model. + * TestContext Framework in conjunction with the JUnit Jupiter testing framework. * *
Any attempt to use the {@code DisabledIfCondition} without the presence of * {@link DisabledIf @DisabledIf} will result in an enabled diff --git a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIf.java b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIf.java index a80f2cef80..47c8364ee5 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIf.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIf.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ import org.springframework.core.annotation.AliasFor; * {@link org.junit.jupiter.api.condition.EnabledOnOs @EnabledOnOs(MAC)} support * in JUnit Jupiter. * - *
Since JUnit 5.7, JUnit Jupiter also has a condition annotation named + *
JUnit Jupiter also has a condition annotation named * {@link org.junit.jupiter.api.condition.EnabledIf @EnabledIf}. Thus, if you * wish to use Spring's {@code @EnabledIf} support make sure you import the * annotation type from the correct package. diff --git a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIfCondition.java b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIfCondition.java index f637c05c52..5b7fe8257c 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIfCondition.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIfCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import org.junit.jupiter.api.extension.ExtensionContext; /** * {@code EnabledIfCondition} is an {@link org.junit.jupiter.api.extension.ExecutionCondition} * that supports the {@link EnabledIf @EnabledIf} annotation when using the Spring - * TestContext Framework in conjunction with JUnit 5's Jupiter programming model. + * TestContext Framework in conjunction with the JUnit Jupiter testing framework. * *
Any attempt to use the {@code EnabledIfCondition} without the presence of * {@link EnabledIf @EnabledIf} will result in an enabled diff --git a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/SpringExtension.java b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/SpringExtension.java index 370f98230c..820725d7e4 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/SpringExtension.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/SpringExtension.java @@ -65,7 +65,7 @@ import org.springframework.util.ReflectionUtils.MethodFilter; /** * {@code SpringExtension} integrates the Spring TestContext Framework - * into JUnit 5's Jupiter programming model. + * into the JUnit Jupiter testing framework. * *
To use this extension, simply annotate a JUnit Jupiter based test class with * {@code @ExtendWith(SpringExtension.class)}, {@code @SpringJUnitConfig}, or diff --git a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/package-info.java b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/package-info.java index 44c237362a..4345689613 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/package-info.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/package-info.java @@ -1,6 +1,6 @@ /** * Core support for integrating the Spring TestContext Framework - * with the JUnit Jupiter extension model in JUnit 5. + * with the JUnit Jupiter testing framework. */ @NullMarked package org.springframework.test.context.junit.jupiter; diff --git a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/web/package-info.java b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/web/package-info.java index 5fd141c9a5..159f3b5e39 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/web/package-info.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/web/package-info.java @@ -1,6 +1,6 @@ /** * Web support for integrating the Spring TestContext Framework - * with the JUnit Jupiter extension model in JUnit 5. + * with the JUnit Jupiter extension model. */ @NullMarked package org.springframework.test.context.junit.jupiter.web; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java b/spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java index 28c8071e1c..b1a55fc355 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import org.junit.platform.suite.api.Suite; /** * JUnit Platform based test suite for tests that involve the Spring TestContext - * Framework and JUnit Jupiter (i.e., JUnit 5's programming model). + * Framework and JUnit Jupiter. * *
This suite is only intended to be used manually within an IDE. *