Deprecate JUnit 4 support in the TestContext framework

Closes gh-34794
This commit is contained in:
Sam Brannen
2025-04-26 08:53:24 +02:00
parent 2db1a63a92
commit c74fc7ec90
61 changed files with 215 additions and 65 deletions

View File

@@ -1,6 +1,13 @@
[[integration-testing-annotations-junit4]]
= Spring JUnit 4 Testing Annotations
[WARNING]
====
JUnit 4 support is deprecated since Spring Framework 7.0 in favor of the
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`]
and JUnit Jupiter.
====
The following annotations are supported only when used in conjunction with the
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit4-runner[SpringRunner],
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit4-rules[Spring's JUnit 4 rules], or
@@ -206,6 +213,3 @@ Kotlin::
----
<1> Repeat this test ten times.
======

View File

@@ -483,6 +483,13 @@ Kotlin::
[[testcontext-junit4-runner]]
=== Spring JUnit 4 Runner
[WARNING]
====
JUnit 4 support is deprecated since Spring Framework 7.0 in favor of the
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`]
and JUnit Jupiter.
====
The Spring TestContext Framework offers full integration with JUnit 4 through a custom
runner (supported on JUnit 4.12 or higher). By annotating test classes with
`@RunWith(SpringJUnit4ClassRunner.class)` or the shorter `@RunWith(SpringRunner.class)`
@@ -538,6 +545,13 @@ be configured through `@ContextConfiguration`.
[[testcontext-junit4-rules]]
=== Spring JUnit 4 Rules
[WARNING]
====
JUnit 4 support is deprecated since Spring Framework 7.0 in favor of the
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`]
and JUnit Jupiter.
====
The `org.springframework.test.context.junit4.rules` package provides the following JUnit
4 rules (supported on JUnit 4.12 or higher):
@@ -607,6 +621,13 @@ Kotlin::
[[testcontext-support-classes-junit4]]
=== JUnit 4 Base Classes
[WARNING]
====
JUnit 4 support is deprecated since Spring Framework 7.0 in favor of the
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-extension[`SpringExtension`]
for JUnit Jupiter.
====
The `org.springframework.test.context.junit4` package provides the following support
classes for JUnit 4-based test cases (supported on JUnit 4.12 or higher):