@@ -100,7 +100,7 @@ public void testBackslashEscaping() throws IOException {
100100 { " 8 " , " \" quoted \" \" /\" / string\" " }, { "9" , " \n " }, };
101101
102102 final CSVFormat format = CSVFormat .newFormat (',' ).withQuote ('\'' ).withRecordSeparator (CRLF ).withEscape ('/' )
103- .withIgnoreEmptyLines (true );
103+ .withIgnoreEmptyLines ();
104104
105105 final CSVParser parser = CSVParser .parse (code , format );
106106 final List <CSVRecord > records = parser .getRecords ();
@@ -127,7 +127,7 @@ public void testBackslashEscaping2() throws IOException {
127127 };
128128
129129 final CSVFormat format = CSVFormat .newFormat (',' ).withRecordSeparator (CRLF ).withEscape ('/' )
130- .withIgnoreEmptyLines (true );
130+ .withIgnoreEmptyLines ();
131131
132132 final CSVParser parser = CSVParser .parse (code , format );
133133 final List <CSVRecord > records = parser .getRecords ();
@@ -299,6 +299,23 @@ public void testEmptyLineBehaviourExcel() throws Exception {
299299 }
300300 }
301301
302+ // @Test
303+ // public void testStartWithEmptyLinesThenHeaders() throws Exception {
304+ // final String[] codes = { "\r\n\r\n\r\nhello,\r\n\r\n\r\n", "hello,\n\n\n", "hello,\"\"\r\n\r\n\r\n", "hello,\"\"\n\n\n" };
305+ // final String[][] res = { { "hello", "" }, { "" }, // Excel format does not ignore empty lines
306+ // { "" } };
307+ // for (final String code : codes) {
308+ // final CSVParser parser = CSVParser.parse(code, CSVFormat.EXCEL);
309+ // final List<CSVRecord> records = parser.getRecords();
310+ // assertEquals(res.length, records.size());
311+ // assertTrue(records.size() > 0);
312+ // for (int i = 0; i < res.length; i++) {
313+ // assertArrayEquals(res[i], records.get(i).values());
314+ // }
315+ // parser.close();
316+ // }
317+ // }
318+
302319 @ Test
303320 public void testEndOfFileBehaviorCSV () throws Exception {
304321 final String [] codes = { "hello,\r \n \r \n world,\r \n " , "hello,\r \n \r \n world," , "hello,\r \n \r \n world,\" \" \r \n " ,
@@ -433,7 +450,7 @@ public void testDuplicateHeaders() throws Exception {
433450
434451 @ Test
435452 public void testGetLine () throws IOException {
436- final CSVParser parser = CSVParser .parse (CSV_INPUT , CSVFormat .DEFAULT .withIgnoreSurroundingSpaces (true ));
453+ final CSVParser parser = CSVParser .parse (CSV_INPUT , CSVFormat .DEFAULT .withIgnoreSurroundingSpaces ());
437454 for (final String [] re : RESULT ) {
438455 assertArrayEquals (re , parser .nextRecord ().values ());
439456 }
@@ -507,7 +524,7 @@ public void testGetRecordNumberWithLF() throws Exception {
507524
508525 @ Test
509526 public void testGetRecords () throws IOException {
510- final CSVParser parser = CSVParser .parse (CSV_INPUT , CSVFormat .DEFAULT .withIgnoreSurroundingSpaces (true ));
527+ final CSVParser parser = CSVParser .parse (CSV_INPUT , CSVFormat .DEFAULT .withIgnoreSurroundingSpaces ());
511528 final List <CSVRecord > records = parser .getRecords ();
512529 assertEquals (RESULT .length , records .size ());
513530 assertTrue (records .size () > 0 );
@@ -584,13 +601,13 @@ public void testHeadersMissingException() throws Exception {
584601 @ Test
585602 public void testHeadersMissing () throws Exception {
586603 final Reader in = new StringReader ("a,,c,,d\n 1,2,3,4\n x,y,z,zz" );
587- CSVFormat .DEFAULT .withHeader ().withAllowMissingColumnNames (true ).parse (in ).iterator ();
604+ CSVFormat .DEFAULT .withHeader ().withAllowMissingColumnNames ().parse (in ).iterator ();
588605 }
589606
590607 @ Test
591608 public void testHeaderMissingWithNull () throws Exception {
592609 final Reader in = new StringReader ("a,,c,,d\n 1,2,3,4\n x,y,z,zz" );
593- CSVFormat .DEFAULT .withHeader ().withNullString ("" ).withAllowMissingColumnNames (true ).parse (in ).iterator ();
610+ CSVFormat .DEFAULT .withHeader ().withNullString ("" ).withAllowMissingColumnNames ().parse (in ).iterator ();
594611 }
595612
596613 @ Test
@@ -668,7 +685,7 @@ public void testLineFeedEndings() throws IOException {
668685 @ Test
669686 public void testMappedButNotSetAsOutlook2007ContactExport () throws Exception {
670687 final Reader in = new StringReader ("a,b,c\n 1,2\n x,y,z" );
671- final Iterator <CSVRecord > records = CSVFormat .DEFAULT .withHeader ("A" , "B" , "C" ).withSkipHeaderRecord (true )
688+ final Iterator <CSVRecord > records = CSVFormat .DEFAULT .withHeader ("A" , "B" , "C" ).withSkipHeaderRecord ()
672689 .parse (in ).iterator ();
673690 CSVRecord record ;
674691
@@ -841,7 +858,7 @@ public void testSkipAutoHeader() throws Exception {
841858 @ Test
842859 public void testSkipSetHeader () throws Exception {
843860 final Reader in = new StringReader ("a,b,c\n 1,2,3\n x,y,z" );
844- final Iterator <CSVRecord > records = CSVFormat .DEFAULT .withHeader ("a" , "b" , "c" ).withSkipHeaderRecord (true )
861+ final Iterator <CSVRecord > records = CSVFormat .DEFAULT .withHeader ("a" , "b" , "c" ).withSkipHeaderRecord ()
845862 .parse (in ).iterator ();
846863 final CSVRecord record = records .next ();
847864 assertEquals ("1" , record .get ("a" ));
0 commit comments