Add parameterized module: JUnit 5 @ParameterizedTest argument sources, display names, and two real anti-pattern failures

This commit is contained in:
Claude
2026-10-03 21:50:52 +00:00
parent 8be1245951
commit ee75bfa792
45 changed files with 1179 additions and 0 deletions
@@ -0,0 +1,26 @@
Captured from a real `junit-platform-console-standalone --details=tree` run against
SharedMutableArgumentAntiPatternTest, compiled and executed for real (badSharedConfigAccumulatesTouches
stays @Disabled here so the module's build remains green; see
docs/output/09-shared-mutable-argument-failure.txt for what it produces when that annotation is
removed).
╷
├─ JUnit Platform Suite ✔
├─ JUnit Jupiter ✔
│ └─ SharedMutableArgumentAntiPatternTest ✔
│ ├─ badSharedConfigAccumulatesTouches(Config) ↷ Kept disabled so the module's build stays green -- see docs/output/09-shared-mutable-argument-failure.txt for the real failure this produces on its second invocation when the @Disabled annotation is removed.
│ └─ goodFreshConfigIsAlwaysTouchedOnce(Config) ✔
│ ├─ [1] Config[callCount=0] ✔
│ └─ [2] Config[callCount=0] ✔
└─ JUnit Vintage ✔
Test run finished after 161 ms
[ 2 tests successful ]
[ 0 tests failed ]
freshProvider() builds a new Config() inside the Stream for each Arguments.of(...) call, so each
invocation gets its own isolated instance -- the whole fix is that simple. Both display names
read Config[callCount=0], which is correct and not a bug: JUnit resolves each invocation's
display name from the argument's toString() at argument-resolution time, before the test method
body (and its config.touch() call) has run, so callCount is still 0 at the moment the name is
built even though the assertion afterwards confirms it becomes 1.