Skip to content

Commit 3b98af3

Browse files
committed
Remove mentions of JUnit 4
This commit removes all mentions of JUnit 4 from the Javadoc and reference documentation. It also harmonizes to simply refers to JUnit. Closes gh-47228
1 parent 8d000e0 commit 3b98af3

File tree

26 files changed

+11
-63
lines changed

26 files changed

+11
-63
lines changed

build-plugin/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/aot.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The `nativeCompile` task of the GraalVM Native Image plugin is automatically con
4444
[[aot.processing-tests]]
4545
== Processing Tests
4646

47-
The AOT engine can be applied to JUnit 5 tests that use Spring's Test Context Framework.
47+
The AOT engine can be applied to JUnit tests that use Spring's Test Context Framework.
4848
Suitable tests are processed by the `processTestAot` task to generate `ApplicationContextInitializer` code.
4949
As with application AOT processing, the `BeanFactory` is fully prepared at build-time.
5050
As with `processAot`, the `processTestAot` task is `JavaExec` subclass and can be configured as needed to influence this processing.

build-plugin/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/aot.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ include::partial$goals/process-aot.adoc[leveloffset=+1]
8989
[[aot.processing-tests]]
9090
== Processing Tests
9191

92-
The AOT engine can be applied to JUnit 5 tests that use Spring's Test Context Framework.
92+
The AOT engine can be applied to JUnit tests that use Spring's Test Context Framework.
9393
Those tests are processed by the AOT engine and are then executed in a native image.
9494

9595
Just like <<aot.processing-applications.using-the-native-profile,for production code>>, the `spring-boot-starter-parent` defines a `nativeTest` profile that can be used to streamline the steps required to execute your tests in a native image.

core/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class TestTypeExcludeFilterTests {
4040
private final MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
4141

4242
@Test
43+
@Deprecated(since = "4.0.0")
4344
void matchesJUnit4TestClass() throws Exception {
4445
assertThat(this.filter.match(getMetadataReader(TestTypeExcludeFilterTests.class), this.metadataReaderFactory))
4546
.isTrue();

core/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* {@link ApplicationContext} and/or custom {@link ImportSelector} implementations.
5050
* <p>
5151
* This class is primarily intended for use with tests that need to specify configuration
52-
* classes but can't use {@link org.springframework.test.context.junit4.SpringRunner}.
52+
* classes.
5353
* <p>
5454
* Implementations of this class should be annotated with {@link Order @Order} or
5555
* implement {@link Ordered}.

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/features/kotlin.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ Note that some features (such as detecting the default value or deprecated items
142142
[[features.kotlin.testing]]
143143
== Testing
144144

145-
While it is possible to use JUnit 4 to test Kotlin code, JUnit 5 is provided by default and is recommended.
146-
JUnit 5 enables a test class to be instantiated once and reused for all of the class's tests.
145+
JUnit enables a test class to be instantiated once and reused for all of the class's tests.
147146
This makes it possible to use javadoc:org.junit.jupiter.api.BeforeAll[format=annotation] and javadoc:org.junit.jupiter.api.AfterAll[format=annotation] annotations on non-static methods, which is a good fit for Kotlin.
148147

149148
To mock Kotlin classes, https://mockk.io/[MockK] is recommended.

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Most developers use the `spring-boot-starter-test` starter, which imports both S
88

99
[TIP]
1010
====
11-
If you have tests that use JUnit 4, JUnit 5's vintage engine can be used to run them.
11+
If you have tests that still use JUnit 4, JUnit's vintage engine can be used to run them.
1212
To use the vintage engine, add a dependency on `junit-vintage-engine`, as shown in the following example:
1313
1414
[source,xml]

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ Spring Boot provides a javadoc:org.springframework.boot.test.context.SpringBootT
99
The annotation works by xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.detecting-configuration[creating the javadoc:org.springframework.context.ApplicationContext[] used in your tests through javadoc:org.springframework.boot.SpringApplication[]].
1010
In addition to javadoc:org.springframework.boot.test.context.SpringBootTest[format=annotation] a number of other annotations are also provided for xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.autoconfigured-tests[testing more specific slices] of an application.
1111

12-
TIP: If you are using JUnit 4, do not forget to also add `@RunWith(SpringRunner.class)` to your test, otherwise the annotations will be ignored.
13-
If you are using JUnit 5, there is no need to add the equivalent `@ExtendWith(SpringExtension.class)` as javadoc:org.springframework.boot.test.context.SpringBootTest[format=annotation] and the other `@...Test` annotations are already annotated with it.
12+
If you are using JUnit, there is no need to add the equivalent `@ExtendWith(SpringExtension.class)` as javadoc:org.springframework.boot.test.context.SpringBootTest[format=annotation] and the other `@...Test` annotations are already annotated with it.
1413

1514
By default, javadoc:org.springframework.boot.test.context.SpringBootTest[format=annotation] will not start a server.
1615
You can use the `webEnvironment` attribute of javadoc:org.springframework.boot.test.context.SpringBootTest[format=annotation] to further refine how your tests run:

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/test-scope-dependencies.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
The `spring-boot-starter-test` starter (in the `test` `scope`) contains the following provided libraries:
55

6-
* https://junit.org/junit5/[JUnit 5]: The de-facto standard for unit testing Java applications.
6+
* https://junit.org/junit5/[JUnit]: The de-facto standard for unit testing Java applications.
77
* {url-spring-framework-docs}/testing/integration.html[Spring Test] & Spring Boot Test: Utilities and integration test support for Spring Boot applications.
88
* https://assertj.github.io/doc/[AssertJ]: A fluent assertion library.
99
* https://github.com/hamcrest/JavaHamcrest[Hamcrest]: A library of matcher objects (also known as constraints or predicates).

loader/spring-boot-loader-classic/src/test/java/org/springframework/boot/loader/jar/JarUrlProtocolHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import org.springframework.test.util.ReflectionTestUtils;
2929

3030
/**
31-
* JUnit 5 {@link Extension} for tests that interact with Spring Boot's {@link Handler}
32-
* for {@code jar:} URLs. Ensures that the handler is registered prior to test execution
33-
* and cleans up the handler's root file cache afterwards.
31+
* JUnit {@link Extension} for tests that interact with Spring Boot's {@link Handler} for
32+
* {@code jar:} URLs. Ensures that the handler is registered prior to test execution and
33+
* cleans up the handler's root file cache afterwards.
3434
*
3535
* @author Andy Wilkinson
3636
*/

module/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/cassandra/DataCassandraTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
* Using this annotation only enables auto-configuration that is relevant to Data Casandra
4444
* tests. Similarly, component scanning is limited to Cassandra repositories and entities
4545
* ({@code @Table}).
46-
* <p>
47-
* When using JUnit 4, this annotation should be used in combination with
48-
* {@code @RunWith(SpringRunner.class)}.
4946
*
5047
* @author Artsiom Yudovin
5148
* @author Stephane Nicoll

0 commit comments

Comments
 (0)