@@ -70,7 +70,7 @@ public class CSVParserTest {
7070
7171 @ Test
7272 public void testGetLine () throws IOException {
73- final CSVParser parser = CSVParser .parseString (CSVINPUT , CSVFormat .DEFAULT .withIgnoreSurroundingSpaces (true ));
73+ final CSVParser parser = CSVParser .parse (CSVINPUT , CSVFormat .DEFAULT .withIgnoreSurroundingSpaces (true ));
7474 for (final String [] re : RESULT ) {
7575 assertArrayEquals (re , parser .nextRecord ().values ());
7676 }
@@ -80,7 +80,7 @@ public void testGetLine() throws IOException {
8080
8181 @ Test
8282 public void testGetRecords () throws IOException {
83- final CSVParser parser = CSVParser .parseString (CSVINPUT , CSVFormat .DEFAULT .withIgnoreSurroundingSpaces (true ));
83+ final CSVParser parser = CSVParser .parse (CSVINPUT , CSVFormat .DEFAULT .withIgnoreSurroundingSpaces (true ));
8484 final List <CSVRecord > records = parser .getRecords ();
8585 assertEquals (RESULT .length , records .size ());
8686 assertTrue (records .size () > 0 );
@@ -101,7 +101,7 @@ public void testExcelFormat1() throws IOException {
101101 {"" },
102102 {"\" hello\" " , " \" world\" " , "abc\n def" , "" }
103103 };
104- final CSVParser parser = CSVParser .parseString (code , CSVFormat .EXCEL );
104+ final CSVParser parser = CSVParser .parse (code , CSVFormat .EXCEL );
105105 final List <CSVRecord > records = parser .getRecords ();
106106 assertEquals (res .length , records .size ());
107107 assertTrue (records .size () > 0 );
@@ -120,7 +120,7 @@ public void testExcelFormat2() throws Exception {
120120 {"" },
121121 {"world" , "" }
122122 };
123- final CSVParser parser = CSVParser .parseString (code , CSVFormat .EXCEL );
123+ final CSVParser parser = CSVParser .parse (code , CSVFormat .EXCEL );
124124 final List <CSVRecord > records = parser .getRecords ();
125125 assertEquals (res .length , records .size ());
126126 assertTrue (records .size () > 0 );
@@ -148,7 +148,7 @@ public void testEndOfFileBehaviourExcel() throws Exception {
148148 };
149149
150150 for (final String code : codes ) {
151- final CSVParser parser = CSVParser .parseString (code , CSVFormat .EXCEL );
151+ final CSVParser parser = CSVParser .parse (code , CSVFormat .EXCEL );
152152 final List <CSVRecord > records = parser .getRecords ();
153153 assertEquals (res .length , records .size ());
154154 assertTrue (records .size () > 0 );
@@ -175,7 +175,7 @@ public void testEndOfFileBehaviorCSV() throws Exception {
175175 {"world" , "" }
176176 };
177177 for (final String code : codes ) {
178- final CSVParser parser = CSVParser .parseString (code , CSVFormat .DEFAULT );
178+ final CSVParser parser = CSVParser .parse (code , CSVFormat .DEFAULT );
179179 final List <CSVRecord > records = parser .getRecords ();
180180 assertEquals (res .length , records .size ());
181181 assertTrue (records .size () > 0 );
@@ -199,7 +199,7 @@ public void testEmptyLineBehaviourExcel() throws Exception {
199199 {"" }
200200 };
201201 for (final String code : codes ) {
202- final CSVParser parser = CSVParser .parseString (code , CSVFormat .EXCEL );
202+ final CSVParser parser = CSVParser .parse (code , CSVFormat .EXCEL );
203203 final List <CSVRecord > records = parser .getRecords ();
204204 assertEquals (res .length , records .size ());
205205 assertTrue (records .size () > 0 );
@@ -221,7 +221,7 @@ public void testEmptyLineBehaviourCSV() throws Exception {
221221 {"hello" , "" } // CSV format ignores empty lines
222222 };
223223 for (final String code : codes ) {
224- final CSVParser parser = CSVParser .parseString (code , CSVFormat .DEFAULT );
224+ final CSVParser parser = CSVParser .parse (code , CSVFormat .DEFAULT );
225225 final List <CSVRecord > records = parser .getRecords ();
226226 assertEquals (res .length , records .size ());
227227 assertTrue (records .size () > 0 );
@@ -233,13 +233,13 @@ public void testEmptyLineBehaviourCSV() throws Exception {
233233
234234 @ Test
235235 public void testEmptyFile () throws Exception {
236- final CSVParser parser = CSVParser .parseString ("" , CSVFormat .DEFAULT );
236+ final CSVParser parser = CSVParser .parse ("" , CSVFormat .DEFAULT );
237237 assertNull (parser .nextRecord ());
238238 }
239239
240240 @ Test
241241 public void testCSV57 () throws Exception {
242- final CSVParser parser = CSVParser .parseString ("" , CSVFormat .DEFAULT );
242+ final CSVParser parser = CSVParser .parse ("" , CSVFormat .DEFAULT );
243243 final List <CSVRecord > list = parser .getRecords ();
244244 assertNotNull (list );
245245 assertEquals (0 , list .size ());
@@ -269,7 +269,7 @@ public void testBackslashEscapingOld() throws IOException {
269269 {"a\\ " , "b" }, // a backslash must be returnd
270270 {"a\\ \\ ,b" } // backslash in quotes only escapes a delimiter (",")
271271 };
272- final CSVParser parser = CSVParser .parseString (code , CSVFormat .DEFAULT );
272+ final CSVParser parser = CSVParser .parse (code , CSVFormat .DEFAULT );
273273 final List <CSVRecord > records = parser .getRecords ();
274274 assertEquals (res .length , records .size ());
275275 assertTrue (records .size () > 0 );
@@ -314,7 +314,7 @@ public void testBackslashEscaping() throws IOException {
314314 final CSVFormat format = CSVFormat .newFormat (',' ).withQuoteChar ('\'' )
315315 .withRecordSeparator (CRLF ).withEscape ('/' ).withIgnoreEmptyLines (true );
316316
317- final CSVParser parser = CSVParser .parseString (code , format );
317+ final CSVParser parser = CSVParser .parse (code , format );
318318 final List <CSVRecord > records = parser .getRecords ();
319319 assertTrue (records .size () > 0 );
320320
@@ -343,7 +343,7 @@ public void testBackslashEscaping2() throws IOException {
343343 final CSVFormat format = CSVFormat .newFormat (',' )
344344 .withRecordSeparator (CRLF ).withEscape ('/' ).withIgnoreEmptyLines (true );
345345
346- final CSVParser parser = CSVParser .parseString (code , format );
346+ final CSVParser parser = CSVParser .parse (code , format );
347347 final List <CSVRecord > records = parser .getRecords ();
348348 assertTrue (records .size () > 0 );
349349
@@ -368,7 +368,7 @@ public void testDefaultFormat() throws IOException {
368368 CSVFormat format = CSVFormat .DEFAULT ;
369369 assertFalse (format .isCommentingEnabled ());
370370
371- CSVParser parser = CSVParser .parseString (code , format );
371+ CSVParser parser = CSVParser .parse (code , format );
372372 List <CSVRecord > records = parser .getRecords ();
373373 assertTrue (records .size () > 0 );
374374
@@ -380,7 +380,7 @@ public void testDefaultFormat() throws IOException {
380380 };
381381
382382 format = CSVFormat .DEFAULT .withCommentStart ('#' );
383- parser = CSVParser .parseString (code , format );
383+ parser = CSVParser .parse (code , format );
384384 records = parser .getRecords ();
385385
386386 Utils .compare ("Failed to parse with comments" , res_comments , records );
@@ -389,7 +389,7 @@ public void testDefaultFormat() throws IOException {
389389 @ Test
390390 public void testCarriageReturnLineFeedEndings () throws IOException {
391391 final String code = "foo\r \n baar,\r \n hello,world\r \n ,kanu" ;
392- final CSVParser parser = CSVParser .parseString (code , CSVFormat .DEFAULT );
392+ final CSVParser parser = CSVParser .parse (code , CSVFormat .DEFAULT );
393393 final List <CSVRecord > records = parser .getRecords ();
394394 assertEquals (4 , records .size ());
395395 }
@@ -408,15 +408,15 @@ public void testClose() throws Exception {
408408 @ Test
409409 public void testCarriageReturnEndings () throws IOException {
410410 final String code = "foo\r baar,\r hello,world\r ,kanu" ;
411- final CSVParser parser = CSVParser .parseString (code , CSVFormat .DEFAULT );
411+ final CSVParser parser = CSVParser .parse (code , CSVFormat .DEFAULT );
412412 final List <CSVRecord > records = parser .getRecords ();
413413 assertEquals (4 , records .size ());
414414 }
415415
416416 @ Test
417417 public void testLineFeedEndings () throws IOException {
418418 final String code = "foo\n baar,\n hello,world\n ,kanu" ;
419- final CSVParser parser = CSVParser .parseString (code , CSVFormat .DEFAULT );
419+ final CSVParser parser = CSVParser .parse (code , CSVFormat .DEFAULT );
420420 final List <CSVRecord > records = parser .getRecords ();
421421 assertEquals (4 , records .size ());
422422 }
@@ -426,7 +426,7 @@ public void testIgnoreEmptyLines() throws IOException {
426426 final String code = "\n foo,baar\n \r \n ,\n \n ,world\r \n \n " ;
427427 //String code = "world\r\n\n";
428428 //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n";
429- final CSVParser parser = CSVParser .parseString (code , CSVFormat .DEFAULT );
429+ final CSVParser parser = CSVParser .parse (code , CSVFormat .DEFAULT );
430430 final List <CSVRecord > records = parser .getRecords ();
431431 assertEquals (3 , records .size ());
432432 }
@@ -452,7 +452,7 @@ public void testRoundtrip() throws Exception {
452452 final StringWriter out = new StringWriter ();
453453 final CSVPrinter printer = new CSVPrinter (out , CSVFormat .DEFAULT );
454454 final String input = "a,b,c\r \n 1,2,3\r \n x,y,z\r \n " ;
455- for (final CSVRecord record : CSVParser .parseString (input , CSVFormat .DEFAULT )) {
455+ for (final CSVRecord record : CSVParser .parse (input , CSVFormat .DEFAULT )) {
456456 printer .printRecord (record );
457457 }
458458 assertEquals (input , out .toString ());
@@ -622,7 +622,7 @@ record = records.next();
622622
623623 @ Test
624624 public void testGetHeaderMap () throws Exception {
625- final CSVParser parser = CSVParser .parseString ("a,b,c\n 1,2,3\n x,y,z" , CSVFormat .DEFAULT .withHeader ("A" , "B" , "C" ));
625+ final CSVParser parser = CSVParser .parse ("a,b,c\n 1,2,3\n x,y,z" , CSVFormat .DEFAULT .withHeader ("A" , "B" , "C" ));
626626 final Map <String , Integer > headerMap = parser .getHeaderMap ();
627627 final Iterator <String > columnNames = headerMap .keySet ().iterator ();
628628 // Headers are iterated in column order.
@@ -665,7 +665,7 @@ public void testGetRecordNumberWithLF() throws Exception {
665665
666666 @ Test
667667 public void testGetRecordWithMultiiLineValues () throws Exception {
668- final CSVParser parser = CSVParser .parseString ("\" a\r \n 1\" ,\" a\r \n 2\" " + CRLF + "\" b\r \n 1\" ,\" b\r \n 2\" " + CRLF + "\" c\r \n 1\" ,\" c\r \n 2\" " ,
668+ final CSVParser parser = CSVParser .parse ("\" a\r \n 1\" ,\" a\r \n 2\" " + CRLF + "\" b\r \n 1\" ,\" b\r \n 2\" " + CRLF + "\" c\r \n 1\" ,\" c\r \n 2\" " ,
669669 CSVFormat .DEFAULT .withRecordSeparator (CRLF ));
670670 CSVRecord record ;
671671 assertEquals (0 , parser .getRecordNumber ());
@@ -704,7 +704,7 @@ public void testInvalidFormat() throws Exception {
704704 }
705705
706706 private void validateRecordNumbers (final String lineSeparator ) throws IOException {
707- final CSVParser parser = CSVParser .parseString ("a" + lineSeparator + "b" + lineSeparator + "c" , CSVFormat .DEFAULT .withRecordSeparator (lineSeparator ));
707+ final CSVParser parser = CSVParser .parse ("a" + lineSeparator + "b" + lineSeparator + "c" , CSVFormat .DEFAULT .withRecordSeparator (lineSeparator ));
708708 CSVRecord record ;
709709 assertEquals (0 , parser .getRecordNumber ());
710710 assertNotNull (record = parser .nextRecord ());
@@ -721,7 +721,7 @@ private void validateRecordNumbers(final String lineSeparator) throws IOExceptio
721721 }
722722
723723 private void validateLineNumbers (final String lineSeparator ) throws IOException {
724- final CSVParser parser = CSVParser .parseString ("a" + lineSeparator + "b" + lineSeparator + "c" , CSVFormat .DEFAULT .withRecordSeparator (lineSeparator ));
724+ final CSVParser parser = CSVParser .parse ("a" + lineSeparator + "b" + lineSeparator + "c" , CSVFormat .DEFAULT .withRecordSeparator (lineSeparator ));
725725 assertEquals (0 , parser .getCurrentLineNumber ());
726726 assertNotNull (parser .nextRecord ());
727727 assertEquals (1 , parser .getCurrentLineNumber ());
0 commit comments