Browse Source

Stop referring to JUnit 5 in documentation

Closes gh-34970
pull/34972/head
Sam Brannen 7 months ago
parent
commit
0f9870b603
  1. 10
      framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc
  2. 4
      framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc
  3. 4
      framework-docs/modules/ROOT/pages/testing/annotations/integration-meta.adoc
  4. 10
      framework-docs/modules/ROOT/pages/testing/testcontext-framework.adoc
  5. 6
      framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc
  6. 4
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIf.java
  7. 4
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIfCondition.java
  8. 4
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIf.java
  9. 4
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIfCondition.java
  10. 2
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/SpringExtension.java
  11. 2
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/package-info.java
  12. 2
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/web/package-info.java
  13. 4
      spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java

10
framework-docs/modules/ROOT/pages/languages/kotlin/spring-projects-in.adoc

@ -324,7 +324,7 @@ progresses. @@ -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 @@ -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. @@ -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 { @@ -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]
----

4
framework-docs/modules/ROOT/pages/testing/annotations/integration-junit-jupiter.adoc

@ -2,8 +2,8 @@ @@ -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`]

4
framework-docs/modules/ROOT/pages/testing/annotations/integration-meta.adoc

@ -140,8 +140,8 @@ Kotlin:: @@ -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]
======

10
framework-docs/modules/ROOT/pages/testing/testcontext-framework.adoc

@ -9,11 +9,11 @@ deal of importance on convention over configuration, with reasonable defaults th @@ -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

6
framework-docs/modules/ROOT/pages/testing/testcontext-framework/support-classes.adoc

@ -9,7 +9,7 @@ in JUnit and TestNG. @@ -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:: @@ -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

4
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIf.java

@ -1,5 +1,5 @@ @@ -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; @@ -55,7 +55,7 @@ import org.springframework.core.annotation.AliasFor;
* {@link org.junit.jupiter.api.condition.DisabledOnOs @DisabledOnOs(MAC)} support
* in JUnit Jupiter.
*
* <p>Since JUnit 5.7, JUnit Jupiter also has a condition annotation named
* <p>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.

4
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIfCondition.java

@ -1,5 +1,5 @@ @@ -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; @@ -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 <em>Spring
* TestContext Framework</em> in conjunction with JUnit 5's <em>Jupiter</em> programming model.
* TestContext Framework</em> in conjunction with the JUnit Jupiter testing framework.
*
* <p>Any attempt to use the {@code DisabledIfCondition} without the presence of
* {@link DisabledIf @DisabledIf} will result in an <em>enabled</em>

4
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIf.java

@ -1,5 +1,5 @@ @@ -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; @@ -55,7 +55,7 @@ import org.springframework.core.annotation.AliasFor;
* {@link org.junit.jupiter.api.condition.EnabledOnOs @EnabledOnOs(MAC)} support
* in JUnit Jupiter.
*
* <p>Since JUnit 5.7, JUnit Jupiter also has a condition annotation named
* <p>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.

4
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIfCondition.java

@ -1,5 +1,5 @@ @@ -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; @@ -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 <em>Spring
* TestContext Framework</em> in conjunction with JUnit 5's <em>Jupiter</em> programming model.
* TestContext Framework</em> in conjunction with the JUnit Jupiter testing framework.
*
* <p>Any attempt to use the {@code EnabledIfCondition} without the presence of
* {@link EnabledIf @EnabledIf} will result in an <em>enabled</em>

2
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/SpringExtension.java

@ -65,7 +65,7 @@ import org.springframework.util.ReflectionUtils.MethodFilter; @@ -65,7 +65,7 @@ import org.springframework.util.ReflectionUtils.MethodFilter;
/**
* {@code SpringExtension} integrates the <em>Spring TestContext Framework</em>
* into JUnit 5's <em>Jupiter</em> programming model.
* into the JUnit Jupiter testing framework.
*
* <p>To use this extension, simply annotate a JUnit Jupiter based test class with
* {@code @ExtendWith(SpringExtension.class)}, {@code @SpringJUnitConfig}, or

2
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/package-info.java

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/**
* Core support for integrating the <em>Spring TestContext Framework</em>
* with the JUnit Jupiter extension model in JUnit 5.
* with the JUnit Jupiter testing framework.
*/
@NullMarked
package org.springframework.test.context.junit.jupiter;

2
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/web/package-info.java

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/**
* Web support for integrating the <em>Spring TestContext Framework</em>
* with the JUnit Jupiter extension model in JUnit 5.
* with the JUnit Jupiter extension model.
*/
@NullMarked
package org.springframework.test.context.junit.jupiter.web;

4
spring-test/src/test/java/org/springframework/test/context/junit/SpringJUnitJupiterTestSuite.java

@ -1,5 +1,5 @@ @@ -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; @@ -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.
*
* <p><strong>This suite is only intended to be used manually within an IDE.</strong>
*

Loading…
Cancel
Save