Add org.apache.commons.csv.CSVPrinterTest.testPrintRecordsWithCSVRecord().
This commit is contained in:
parent
7aa3b46719
commit
979134603b
|
@ -1336,6 +1336,21 @@ public class CSVPrinterTest {
|
|||
assertEquals(content, sw.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrintRecordsWithCSVRecord() throws IOException {
|
||||
final String[] values = new String[] {"A", "B", "C"};
|
||||
final String rowData = StringUtils.join(values, ',');
|
||||
final CharArrayWriter charArrayWriter = new CharArrayWriter(0);
|
||||
try (final CSVParser parser = CSVFormat.DEFAULT.parse(new StringReader(rowData));
|
||||
CSVPrinter csvPrinter = CSVFormat.INFORMIX_UNLOAD.print(charArrayWriter)) {
|
||||
for (CSVRecord record : parser) {
|
||||
csvPrinter.printRecord(record);
|
||||
}
|
||||
}
|
||||
assertEquals(6, charArrayWriter.size());
|
||||
assertEquals("A|B|C" + CSVFormat.INFORMIX_UNLOAD.getRecordSeparator(), charArrayWriter.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrintRecordsWithEmptyVector() throws IOException {
|
||||
final PrintStream out = System.out;
|
||||
|
|
Loading…
Reference in New Issue