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 2015/08/29 22:51:46 UTC

svn commit: r1700073 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java

Author: ggregory
Date: Sat Aug 29 20:51:46 2015
New Revision: 1700073

URL: http://svn.apache.org/r1700073
Log:
Test CSV-154.

Modified:
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java?rev=1700073&r1=1700072&r2=1700073&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java Sat Aug 29 20:51:46 2015
@@ -30,10 +30,12 @@ import static org.junit.Assert.assertTru
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Arrays;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 /**
@@ -375,6 +377,20 @@ public class CSVFormatTest {
     }
 
     @Test
+    public void testJIraCsv154() throws IOException {
+        final String comment = "This is a header comment";
+        CSVFormat format = CSVFormat.EXCEL.withHeader("H1", "H2").withCommentMarker('#')
+                .withHeaderComments(comment);
+        StringBuilder out = new StringBuilder();
+        final CSVPrinter printer = format.print(out);
+        printer.print("A");
+        printer.print("B");
+        printer.close();
+        String s = out.toString();
+        Assert.assertTrue(s, s.contains(comment));
+    }
+    
+    @Test
     public void testWithIgnoreEmptyLines() throws Exception {
         assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).getIgnoreEmptyLines());
         assertTrue(CSVFormat.DEFAULT.withIgnoreEmptyLines().getIgnoreEmptyLines());