@@ -146,7 +146,7 @@ private void doOneRandom(final CSVFormat format) throws Exception {
146146 for (int i = 0 ; i < expected .length ; i ++) {
147147 expected [i ] = expectNulls (expected [i ], format );
148148 }
149- Utils .compare ("Printer output :" + printable (result ), expected , parseResult );
149+ Utils .compare ("Printer output :" + printable (result ), expected , parseResult , - 1 );
150150 }
151151 }
152152
@@ -1470,7 +1470,7 @@ public void testPrintCSVParser() throws IOException {
14701470 try (CSVParser parser = CSVParser .parse (sw .toString (), format )) {
14711471 final List <CSVRecord > records = parser .getRecords ();
14721472 assertFalse (records .isEmpty ());
1473- Utils .compare ("Fail" , res , records );
1473+ Utils .compare ("Fail" , res , records , - 1 );
14741474 }
14751475 }
14761476
@@ -1498,20 +1498,21 @@ public void testPrintCSVRecord() throws IOException {
14981498 try (CSVParser parser = CSVParser .parse (sw .toString (), format )) {
14991499 final List <CSVRecord > records = parser .getRecords ();
15001500 assertFalse (records .isEmpty ());
1501- Utils .compare ("Fail" , res , records );
1501+ Utils .compare ("Fail" , res , records , - 1 );
15021502 }
15031503 }
15041504
1505- @ Test
1506- public void testPrintCSVRecords () throws IOException {
1505+ @ ParameterizedTest
1506+ @ ValueSource (ints = { -1 , 0 , 3 , 4 , Integer .MAX_VALUE })
1507+ public void testPrintCSVRecords (final int maxRows ) throws IOException {
15071508 // @formatter:off
15081509 final String code = "a1,b1\n " + // 1)
15091510 "a2,b2\n " + // 2)
15101511 "a3,b3\n " + // 3)
15111512 "a4,b4\n " ; // 4)
15121513 // @formatter:on
1513- final String [][] res = { { "a1" , "b1" }, { "a2" , "b2" }, { "a3" , "b3" }, { "a4" , "b4" } };
1514- final CSVFormat format = CSVFormat .DEFAULT ;
1514+ final String [][] expected = { { "a1" , "b1" }, { "a2" , "b2" }, { "a3" , "b3" }, { "a4" , "b4" } };
1515+ final CSVFormat format = CSVFormat .DEFAULT . builder (). setMaxRows ( maxRows ). get () ;
15151516 final StringWriter sw = new StringWriter ();
15161517 try (CSVPrinter printer = format .print (sw );
15171518 CSVParser parser = CSVParser .parse (code , format )) {
@@ -1521,7 +1522,7 @@ public void testPrintCSVRecords() throws IOException {
15211522 try (CSVParser parser = CSVParser .parse (sw .toString (), format )) {
15221523 final List <CSVRecord > records = parser .getRecords ();
15231524 assertFalse (records .isEmpty ());
1524- Utils .compare ("Fail" , res , records );
1525+ Utils .compare ("Fail" , expected , records , maxRows );
15251526 }
15261527 }
15271528
@@ -1690,7 +1691,7 @@ public void testPrintRecordStream() throws IOException {
16901691 try (CSVParser parser = CSVParser .parse (sw .toString (), format )) {
16911692 final List <CSVRecord > records = parser .getRecords ();
16921693 assertFalse (records .isEmpty ());
1693- Utils .compare ("Fail" , res , records );
1694+ Utils .compare ("Fail" , res , records , - 1 );
16941695 }
16951696 }
16961697
0 commit comments