You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/11 19:08:34 UTC
[commons-csv] branch master updated: Add
org.apache.commons.csv.CSVPrinterTest.testPrintRecordsWithCSVRecord().
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git
The following commit(s) were added to refs/heads/master by this push:
new 9791346 Add org.apache.commons.csv.CSVPrinterTest.testPrintRecordsWithCSVRecord().
9791346 is described below
commit 979134603b23af24a945d48461a6b6c6d6d79618
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Nov 11 14:08:30 2020 -0500
Add org.apache.commons.csv.CSVPrinterTest.testPrintRecordsWithCSVRecord().
---
src/test/java/org/apache/commons/csv/CSVPrinterTest.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index 0c203b8..7126e9d 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -1337,6 +1337,21 @@ public class CSVPrinterTest {
}
@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;
try {