Skip to content

Commit f9871c5

Browse files
committed
[CSV-121] Exception that the header contains duplicate names when the column names are empty. Add a test that shows that TWO missing header is not OK.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1602168 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5a9436d commit f9871c5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/test/java/org/apache/commons/csv/CSVParserTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,12 @@ public void testHeaderMissing() throws Exception {
649649
assertFalse(records.hasNext());
650650
}
651651

652+
@Test(expected=IllegalArgumentException.class)
653+
public void testHeadersMissingException() throws Exception {
654+
final Reader in = new StringReader("a,,c,,d\n1,2,3,4\nx,y,z,zz");
655+
CSVFormat.DEFAULT.withHeader().parse(in).iterator();
656+
}
657+
652658
@Test
653659
public void testHeaderComment() throws Exception {
654660
final Reader in = new StringReader("# comment\na,b,c\n1,2,3\nx,y,z");

0 commit comments

Comments
 (0)