Skip to content

Commit 5067d62

Browse files
authored
Add tests for whitespace within CsvSource columns (#2383)
1 parent 1ae3b40 commit 5067d62

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSource.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
* comma-separated values (CSV) from one or more supplied
2727
* {@linkplain #value CSV lines}.
2828
*
29+
* <p>The column delimiter (defaults to comma) can be customized with either
30+
* {@link #delimiter()} or {@link #delimiterString()}.
31+
*
2932
* <p>The supplied values will be provided as arguments to the
3033
* annotated {@code @ParameterizedTest} method.
3134
*

junit-jupiter-params/src/test/java/org/junit/jupiter/params/provider/CsvArgumentsProviderTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ void understandsEscapeCharacters() {
9797
assertThat(arguments).containsExactly(array("foo or 'bar'", "baz"));
9898
}
9999

100+
@Test
101+
void doesNotTrimSpacesInsideQuotes() {
102+
CsvSource annotation = csvSource("''", "' '", "'blank '", "' not blank '");
103+
104+
Stream<Object[]> arguments = provideArguments(annotation);
105+
106+
assertThat(arguments).containsExactly(array(""), array(" "), array("blank "), array(" not blank "));
107+
}
108+
100109
@Test
101110
void providesArgumentsWithCharacterDelimiter() {
102111
CsvSource annotation = csvSource().delimiter('|').lines("foo|bar", "bar|foo").build();

0 commit comments

Comments
 (0)