I haven't found a way to escape the ,
character in CSV resource file that is used by CsvFileSource
junit5
annotation. Consequently, any string containing comma is cut in half and the second part is never used.
Is there some workaround for this?
EDIT: The original question was not complete. The problem is I have commas and double quotes in my resource. Parametrized tests deal with the quotes but not with both.
Example CSV line:
5,10,5,53,"</identity/partners?limit=5&cursor=5>; rel="prev", </identity/partners?limit=5&cursor=15>; rel="next""
Quotes are escaped correctly but only until a wild comma appears (that is the algorithm I might guess).
So the resulting assert looks like this:
"Link" was not "\"</identity/partners?limit=5&cursor=5>; rel=\"prev\"", was "</identity/partners?limit=5&cursor=5>; rel="prev", </identity/partners?limit=5&cursor=15>; rel="next""
Wrap your value in double quotes:
"first, value", second, third and last one
More details here: http://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests-sources-CsvFileSource
In your case, you may specify an entire different delimiter character in the annotation: https://junit.org/junit5/docs/current/api/org.junit.jupiter.params/org/junit/jupiter/params/provider/CsvFileSource.html#delimiter()
But then it is no longer "comma" separated values...