@@ -709,13 +709,19 @@ public void testExcelPrintAllIterableOfLists() throws IOException {
709709 }
710710 }
711711
712- @ Test
713- public void testExcelPrintAllStreamOfArrays () throws IOException {
712+ @ ParameterizedTest
713+ @ ValueSource (longs = { -1 , 0 , 1 , 2 , Integer .MAX_VALUE })
714+ public void testExcelPrintAllStreamOfArrays (final long maxRows ) throws IOException {
714715 final StringWriter sw = new StringWriter ();
715- try (CSVPrinter printer = new CSVPrinter (sw , CSVFormat .EXCEL )) {
716+ final CSVFormat format = CSVFormat .EXCEL .builder ().setMaxRows (maxRows ).get ();
717+ try (CSVPrinter printer = new CSVPrinter (sw , format )) {
716718 assertInitialState (printer );
717719 printer .printRecords (Stream .of (new String [][] { { "r1c1" , "r1c2" }, { "r2c1" , "r2c2" } }));
718- assertEquals ("r1c1,r1c2" + RECORD_SEPARATOR + "r2c1,r2c2" + RECORD_SEPARATOR , sw .toString ());
720+ String expected = "r1c1,r1c2" + RECORD_SEPARATOR ;
721+ if (maxRows != 1 ) {
722+ expected += "r2c1,r2c2" + RECORD_SEPARATOR ;
723+ }
724+ assertEquals (expected , sw .toString ());
719725 }
720726 }
721727
@@ -834,8 +840,8 @@ public void testJdbcPrinterWithFirstEmptyValue2() throws IOException, ClassNotFo
834840 }
835841
836842 @ ParameterizedTest
837- @ ValueSource (ints = { -1 , 0 , 1 , 2 , 3 , 4 , Integer .MAX_VALUE })
838- public void testJdbcPrinterWithResultSet (final int maxRows ) throws IOException , ClassNotFoundException , SQLException {
843+ @ ValueSource (longs = { -1 , 0 , 1 , 2 , 3 , 4 , Integer .MAX_VALUE })
844+ public void testJdbcPrinterWithResultSet (final long maxRows ) throws IOException , ClassNotFoundException , SQLException {
839845 final StringWriter sw = new StringWriter ();
840846 final CSVFormat format = CSVFormat .DEFAULT .builder ().setMaxRows (maxRows ).get ();
841847 try (Connection connection = getH2Connection ()) {
@@ -862,8 +868,8 @@ public void testJdbcPrinterWithResultSet(final int maxRows) throws IOException,
862868 }
863869
864870 @ ParameterizedTest
865- @ ValueSource (ints = { -1 , 0 , 3 , 4 , Integer .MAX_VALUE })
866- public void testJdbcPrinterWithResultSetHeader (final int maxRows ) throws IOException , ClassNotFoundException , SQLException {
871+ @ ValueSource (longs = { -1 , 0 , 3 , 4 , Integer .MAX_VALUE })
872+ public void testJdbcPrinterWithResultSetHeader (final long maxRows ) throws IOException , ClassNotFoundException , SQLException {
867873 final StringWriter sw = new StringWriter ();
868874 try (Connection connection = getH2Connection ()) {
869875 setUpTable (connection );
@@ -887,8 +893,8 @@ public void testJdbcPrinterWithResultSetHeader(final int maxRows) throws IOExcep
887893 }
888894
889895 @ ParameterizedTest
890- @ ValueSource (ints = { -1 , 0 , 3 , 4 , Integer .MAX_VALUE })
891- public void testJdbcPrinterWithResultSetMetaData (final int maxRows ) throws IOException , ClassNotFoundException , SQLException {
896+ @ ValueSource (longs = { -1 , 0 , 3 , 4 , Integer .MAX_VALUE })
897+ public void testJdbcPrinterWithResultSetMetaData (final long maxRows ) throws IOException , ClassNotFoundException , SQLException {
892898 final StringWriter sw = new StringWriter ();
893899 try (Connection connection = getH2Connection ()) {
894900 setUpTable (connection );
@@ -1503,8 +1509,8 @@ public void testPrintCSVRecord() throws IOException {
15031509 }
15041510
15051511 @ ParameterizedTest
1506- @ ValueSource (ints = { -1 , 0 , 3 , 4 , Integer .MAX_VALUE })
1507- public void testPrintCSVRecords (final int maxRows ) throws IOException {
1512+ @ ValueSource (longs = { -1 , 0 , 3 , 4 , Integer .MAX_VALUE })
1513+ public void testPrintCSVRecords (final long maxRows ) throws IOException {
15081514 // @formatter:off
15091515 final String code = "a1,b1\n " + // 1)
15101516 "a2,b2\n " + // 2)
0 commit comments