@@ -79,9 +79,13 @@ class CSVParserTest {
7979
8080 private static final String UTF_8_NAME = UTF_8 .name ();
8181
82- private static final String CSV_INPUT = "a,b,c,d\n " + " a , b , 1 2 \n " + "\" foo baar\" , b,\n " +
82+ // @formatter:off
83+ private static final String CSV_INPUT = "a,b,c,d\n " +
84+ " a , b , 1 2 \n " +
85+ "\" foo baar\" , b,\n " +
8386 // + " \"foo\n,,\n\"\",,\n\\\"\",d,e\n";
8487 " \" foo\n ,,\n \" \" ,,\n \" \" \" ,d,e\n " ; // changed to use standard CSV escaping
88+ // @formatter:on
8589
8690 private static final String CSV_INPUT_1 = "a,b,c,d" ;
8791
@@ -181,7 +185,7 @@ void testBackslashEscaping2() throws IOException {
181185 // We will test with a forward slash as the escape char, and a single
182186 // quote as the encapsulator.
183187 // @formatter:off
184- final String code = "" + " , , \n " + // 1)
188+ final String code = " , , \n " + // 1)
185189 " \t , , \n " + // 2)
186190 " // , /, , /,\n " + // 3)
187191 "" ;
@@ -201,8 +205,17 @@ void testBackslashEscaping2() throws IOException {
201205 @ Test
202206 @ Disabled
203207 void testBackslashEscapingOld () throws IOException {
204- final String code = "one,two,three\n " + "on\\ \" e,two\n " + "on\" e,two\n " + "one,\" tw\\ \" o\" \n " + "one,\" t\\ ,wo\" \n " + "one,two,\" th,ree\" \n " +
205- "\" a\\ \\ \" \n " + "a\\ ,b\n " + "\" a\\ \\ ,b\" " ;
208+ // @formatter:off
209+ final String code = "one,two,three\n " +
210+ "on\\ \" e,two\n " +
211+ "on\" e,two\n " +
212+ "one,\" tw\\ \" o\" \n " +
213+ "one,\" t\\ ,wo\" \n " +
214+ "one,two,\" th,ree\" \n " +
215+ "\" a\\ \\ \" \n " +
216+ "a\\ ,b\n " +
217+ "\" a\\ \\ ,b\" " ;
218+ // @formatter:on
206219 final String [][] res = { { "one" , "two" , "three" }, { "on\\ \" e" , "two" }, { "on\" e" , "two" }, { "one" , "tw\" o" }, { "one" , "t\\ ,wo" }, // backslash in
207220 // quotes only
208221 // escapes a
@@ -417,7 +430,7 @@ void testCSV57() throws Exception {
417430 @ Test
418431 void testDefaultFormat () throws IOException {
419432 // @formatter:off
420- final String code = "" + " a,b#\n " + // 1)
433+ final String code = "a,b#\n " + // 1)
421434 "\" \n \" ,\" \" ,#\n " + // 2)
422435 "#,\" \" \n " + // 3)
423436 "# Final comment\n " // 4)
@@ -548,7 +561,7 @@ void testEndOfFileBehaviorExcel() throws Exception {
548561
549562 @ Test
550563 void testExcelFormat1 () throws IOException {
551- final String code = "value1,value2,value3,value4\r \n a,b,c,d\r \n x,,," + " \r \n \r \n \" \" \" hello\" \" \" ,\" \" \" world\" \" \" ,\" abc\n def\" ,\r \n " ;
564+ final String code = "value1,value2,value3,value4\r \n a,b,c,d\r \n x,,,\r \n \r \n \" \" \" hello\" \" \" ,\" \" \" world\" \" \" ,\" abc\n def\" ,\r \n " ;
552565 final String [][] res = { { "value1" , "value2" , "value3" , "value4" }, { "a" , "b" , "c" , "d" }, { " x" , "" , "" , "" }, { "" },
553566 { "\" hello\" " , " \" world\" " , "abc\n def" , "" } };
554567 try (CSVParser parser = CSVParser .parse (code , CSVFormat .EXCEL )) {
0 commit comments