From f9871c5d359f61c04ba567df58af206b676ad9f3 Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Thu, 12 Jun 2014 13:59:33 +0000 Subject: [PATCH] [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 --- src/test/java/org/apache/commons/csv/CSVParserTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/org/apache/commons/csv/CSVParserTest.java b/src/test/java/org/apache/commons/csv/CSVParserTest.java index ad40255e..4399e602 100644 --- a/src/test/java/org/apache/commons/csv/CSVParserTest.java +++ b/src/test/java/org/apache/commons/csv/CSVParserTest.java @@ -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");