[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
This commit is contained in:
Gary D. Gregory 2014-06-12 13:59:33 +00:00
parent 5a9436d462
commit f9871c5d35
1 changed files with 6 additions and 0 deletions

View File

@ -649,6 +649,12 @@ public class CSVParserTest {
assertFalse(records.hasNext());
}
@Test(expected=IllegalArgumentException.class)
public void testHeadersMissingException() throws Exception {
final Reader in = new StringReader("a,,c,,d\n1,2,3,4\nx,y,z,zz");
CSVFormat.DEFAULT.withHeader().parse(in).iterator();
}
@Test
public void testHeaderComment() throws Exception {
final Reader in = new StringReader("# comment\na,b,c\n1,2,3\nx,y,z");