File tree Expand file tree Collapse file tree
src/test/java/org/apache/commons/csv Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1336,6 +1336,21 @@ public void testPrintReaderWithoutQuoteToWriter() throws IOException {
13361336 assertEquals (content , sw .toString ());
13371337 }
13381338
1339+ @ Test
1340+ public void testPrintRecordsWithCSVRecord () throws IOException {
1341+ final String [] values = new String [] {"A" , "B" , "C" };
1342+ final String rowData = StringUtils .join (values , ',' );
1343+ final CharArrayWriter charArrayWriter = new CharArrayWriter (0 );
1344+ try (final CSVParser parser = CSVFormat .DEFAULT .parse (new StringReader (rowData ));
1345+ CSVPrinter csvPrinter = CSVFormat .INFORMIX_UNLOAD .print (charArrayWriter )) {
1346+ for (CSVRecord record : parser ) {
1347+ csvPrinter .printRecord (record );
1348+ }
1349+ }
1350+ assertEquals (6 , charArrayWriter .size ());
1351+ assertEquals ("A|B|C" + CSVFormat .INFORMIX_UNLOAD .getRecordSeparator (), charArrayWriter .toString ());
1352+ }
1353+
13391354 @ Test
13401355 public void testPrintRecordsWithEmptyVector () throws IOException {
13411356 final PrintStream out = System .out ;
You can’t perform that action at this time.
0 commit comments