You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@CsvSource allows users to provide CSV content as an array of strings,
where each string represents a line in a CSV file.
With the introduction of support for text blocks as a first-class
language feature in recent JDKs (preview feature in Java SE 15), we can
improve the user experience with @CsvSource by allowing the user to
provide a text block instead of an array of strings.
This commit introduces a new textBlock attribute in @CsvSource that
allows users to take advantage of the text block support in their
programming language.
Given the following parameterized test using a text block...
@ParameterizedTest
@CsvSource(textBlock = """
apple, 1
banana, 2
'lemon, lime', 0xF1
strawberry, 700_000
""")
void csvSourceWithTextBlock(String fruit, int rank) {
System.out.println(fruit + " : " + rank);
}
... the output is:
apple : 1
banana : 2
lemon, lime : 241
strawberry : 700000
Closes#2721
0 commit comments