Andy897
Andy897

Reputation: 7133

How to ignore lines using JUnit 5's @CsvFileSource

I am using @CsvFileSource annotation of JUnit 5 to parameterize my test cases, but I am not able to ignore the comments from in the CSV file.

Any thoughts on how to do this?

Example CSV:

apple fruit sweet
carrot vegetable sweet
// lemon vegetable sour  (Ignore this)
banana fruit sweet

Upvotes: 3

Views: 1314

Answers (1)

eee
eee

Reputation: 3468

Use a # at the beginning of the comment lines:

apple, fruit, sweet
carrot, vegetable, sweet
# lemon, vegetable, sour
banana, fruit, sweet

Upvotes: 6

Related Questions