Upgrade to JUnit 6.0.1 and prevent AOT scanning failure for JUnit 4 tests

This commit upgrades our test suite to use JUnit 6.0.1 and removes the
systemProperty("junit.platform.discovery.issue.severity.critical", "WARNING")
configuration from spring-test.gradle, so that all discovery issues will
fail the build for the spring-test module as well.

In addition, this commit prevents potential AOT test scanning failures
for JUnit 4 tests by setting the
"junit.vintage.discovery.issue.reporting.enabled" configuration
parameter to "false" in TestClassScanner.

See https://github.com/junit-team/junit-framework/issues/5030
Closes gh-35740
This commit is contained in:
Sam Brannen
2025-11-01 11:13:37 +01:00
parent f2cfc692cf
commit 324b254849
5 changed files with 19 additions and 8 deletions
@@ -142,7 +142,12 @@ class TestClassScanner {
if (packageNames.length > 0) {
builder.filters(includePackageNames(packageNames));
}
LauncherDiscoveryRequest request = builder.build();
LauncherDiscoveryRequest request = builder
// In case junit.platform.discovery.issue.severity.critical=INFO has been configured,
// we do not want scanning to fail due to the deprecation of the Vintage test engine.
// So, we disable reporting of the deprecation discovery issue.
.configurationParameter("junit.vintage.discovery.issue.reporting.enabled", "false")
.build();
Launcher launcher = LauncherFactory.create();
TestPlan testPlan = launcher.discover(request);