Commit c8000fc
committed
Cache generated {arguments} patterns for parameterized tests
Prior to this commit, {arguments} patterns were generated for every
@ParameterizedTest and @ParameterizedClass, which could result in
generation of the same pattern strings hundreds of times per test suite.
Specifically, without caching, JUnit Jupiter generated strings like
"{0}, {1}", "{0}, {1}, {2}", "{0}, {1}, {2}, {3}", etc. each time such
a pattern was needed.
To prevent regeneration of identical patterns, this commit modifies
ParameterizedInvocationNameFormatter so that it caches each generated
pattern in a map, keyed by the number of arguments.
Prior to this commit, we generated {arguments} patterns 330 times when
running JupiterTestSuite. Whereas, with caching in place we now only
generate {arguments} patterns 10 times for the same test suite.
Closes #48041 parent b9618a8 commit c8000fc
File tree
1 file changed
+15
-5
lines changed- junit-jupiter-params/src/main/java/org/junit/jupiter/params
1 file changed
+15
-5
lines changedLines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
186 | 191 | | |
187 | 192 | | |
188 | 193 | | |
189 | | - | |
190 | | - | |
191 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
192 | 202 | | |
193 | 203 | | |
194 | 204 | | |
| |||
0 commit comments