-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Milestone
Description
Currently, junit silently accepts invalid values for junit.platform.discovery.issue.severity.critical like warn, so the users might fail to configure JUnit properly.
Here's an example the code which looks wrong: ccfdbd1#diff-3eb48f8e637e1a15e94eb16d5297cfbb97e32c105cb76cfe0a714e652aded9fbR205
At least, when I try warn, it does not work for me with JUnit 5.13.0:
junit.platform.discovery.issue.severity.critical=warn:
Gradle Test Executor 9 STANDARD_ERROR
июн. 04, 2025 6:52:24 PM org.junit.platform.launcher.core.DiscoveryIssueCollector lambda$getCriticalSeverity$7
WARNING: Invalid DiscoveryIssue.Severity 'warn' set via the 'junit.platform.discovery.issue.severity.critical' configuration parameter. Falling back to the ERROR default value.
2,3sec, org.postgresql.core.AsciiStringInternerTest > garbageCleaning()
2,3sec, 5 completed, 0 failed, 0 skipped, org.postgresql.core.AsciiStringInternerTest
If I specify it as "junit.platform.discovery.issue.severity.critical", "warning", then I manage the discovery to fail.
FAILURE 0,0sec, UnknownClass > initializationError
org.junit.platform.launcher.core.DiscoveryIssueException: TestEngine with ID 'junit-jupiter' encountered 2 critical issues during test discovery:
(1) [WARNING] @Test method 'private int org.postgresql.test.jdbc42.SetObject310InfinityTest.abc()' must not be private. It will not be executed.
Source: MethodSource [className = 'org.postgresql.test.jdbc42.SetObject310InfinityTest', methodName = 'abc', methodParameterTypes = '']
at org.postgresql.test.jdbc42.SetObject310InfinityTest.abc(SourceFile:0)
(2) [WARNING] @Test method 'private int org.postgresql.test.jdbc42.SetObject310InfinityTest.abc()' must not return a value. It will not be executed.
Source: MethodSource [className = 'org.postgresql.test.jdbc42.SetObject310InfinityTest', methodName = 'abc', methodParameterTypes = '']
at org.postgresql.test.jdbc42.SetObject310InfinityTest.abc(SourceFile:0)
I would prefer JUnit to fail in case user configures an invalid value for junit.platform.discovery.issue.severity.critical.