如何使用JUnit 5的@CsvFileSource忽略行

问题描述 投票:1回答:1

我使用JUnit 5的@CsvFileSource注释来参数化我的测试用例,但我无法忽略CSV文件中的注释。

有关如何做到这一点的任何想法?

示例CSV:

apple fruit sweet
carrot vegetable sweet
// lemon vegetable sour  (Ignore this)
banana fruit sweet
csv junit5
1个回答
3
投票

在注释行的开头使用#

apple, fruit, sweet
carrot, vegetable, sweet
# lemon, vegetable, sour
banana, fruit, sweet
© www.soinside.com 2019 - 2024. All rights reserved.