Skip to content

Commit 78a3d2e

Browse files
committed
Document reason for caching formatters by arguments length
Issue: #4805
1 parent f7a4ab9 commit 78a3d2e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedInvocationNameFormatter.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,19 @@ private String truncateIfExceedsMaxLength(String argument) {
307307
}
308308
}
309309

310+
/**
311+
* Caches formatters by the length of the consumed <em>arguments</em> which
312+
* may differ from the number of declared parameters.
313+
*
314+
* <p>For example, when using multiple providers or a provider that returns
315+
* argument arrays of different length, such as:
316+
*
317+
* <pre>
318+
* &#064;ParameterizedTest
319+
* &#064;CsvSource({"a", "a,b", "a,b,c"})
320+
* void test(ArgumentsAccessor accessor) {}
321+
* </pre>
322+
*/
310323
private static class CachingByArgumentsLengthPartialFormatter implements PartialFormatter {
311324

312325
private final ConcurrentMap<Integer, PartialFormatter> cache = new ConcurrentHashMap<>(1);

0 commit comments

Comments
 (0)