You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support for JUnit 4 was introduced in Spring Framework 2.5 in 2007.
JUnit 4 is no longer actively maintained, and the last maintenance release was JUnit 4.13.2 in February 2021.
In addition, JUnit 4 has a Java 1.5 baseline.
Support for JUnit Jupiter (JUnit 5) was introduced in Spring Framework 5.0 in 2017.
JUnit Jupiter was initially released with JUnit 5.0 in September 2017. JUnit Jupiter is actively maintained and has a Java 8 baseline. The last maintenance release was 5.12.2 two weeks ago (April 11, 2025).
Furthermore, the JUnit team is planning to release JUnit 6.0 with a Java 17 baseline later this year (junit-team/junit5#4246).
In light of the above, it is time to phase out our support for JUnit 4 by deprecating it in Spring Framework 7.0 and deprecating it "for removal" in 7.1 or 7.2 (tentatively for removal in Spring Framework 8.0).
Components to Deprecate
@IfProfileValue
@ProfileValueSourceConfiguration
ProfileValueSource and SystemProfileValueSource
ProfileValueUtils
@Repeat and @Timed
TestAnnotationUtils
SpringJUnit4ClassRunner and SpringRunner
SpringClassRule and SpringMethodRule
AbstractJUnit4SpringContextTests and AbstractTransactionalJUnit4SpringContextTests
All Statement implementations in the org.springframework.test.context.junit4.statements package
In Spring Framework 5.2, we migrated most of the test suite from JUnit
4 to JUnit Jupiter; however, prior to this commit, several tests in the
spring-test module were still based on JUnit 4 unnecessarily.
Since we are now planning to deprecate our JUnit 4 support in 7.0, this
commit migrates our remaining JUnit 4 based tests to JUnit Jupiter
whenever feasible. In the process, test classes that previously resided
under the "junit4" package have been moved to new packages directly
under the "org.springframework.text.context" package, and several
classes have been renamed for greater clarity of purpose.
Consequently, the only remaining tests based on JUnit 4 are those tests
that are required to run with JUnit 4 in order to test our JUnit 4
support.
This commit also greatly simplifies exclusions for Checkstyle rules
pertaining to JUnit usage.
See gh-23451
See gh-34794Closesgh-34813
In 49e5c84 I unfortunately overlooked
several JUnit 4 based tests in the `junit4` package that should be
migrated to JUnit Jupiter.
This commit address those remaining test classes.
See gh-23451
See gh-34794Closesgh-34813
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Apr 26, 2025
Overview
Support for JUnit 4 was introduced in Spring Framework 2.5 in 2007.
JUnit 4 is no longer actively maintained, and the last maintenance release was JUnit 4.13.2 in February 2021.
In addition, JUnit 4 has a Java 1.5 baseline.
Support for JUnit Jupiter (JUnit 5) was introduced in Spring Framework 5.0 in 2017.
JUnit Jupiter was initially released with JUnit 5.0 in September 2017. JUnit Jupiter is actively maintained and has a Java 8 baseline. The last maintenance release was 5.12.2 two weeks ago (April 11, 2025).
Furthermore, the JUnit team is planning to release JUnit 6.0 with a Java 17 baseline later this year (junit-team/junit5#4246).
In light of the above, it is time to phase out our support for JUnit 4 by deprecating it in Spring Framework 7.0 and deprecating it "for removal" in 7.1 or 7.2 (tentatively for removal in Spring Framework 8.0).
Components to Deprecate
@IfProfileValue
@ProfileValueSourceConfiguration
ProfileValueSource
andSystemProfileValueSource
ProfileValueUtils
@Repeat
and@Timed
TestAnnotationUtils
SpringJUnit4ClassRunner
andSpringRunner
SpringClassRule
andSpringMethodRule
AbstractJUnit4SpringContextTests
andAbstractTransactionalJUnit4SpringContextTests
Statement
implementations in theorg.springframework.test.context.junit4.statements
packageRelated Issues
The text was updated successfully, but these errors were encountered: