From 68c74f627495b2c60d3b0ff6a1ddc0cad8b7d49e Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Sat, 29 Aug 2015 20:51:46 +0000 Subject: [PATCH] Test CSV-154. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1700073 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/csv/CSVFormatTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/java/org/apache/commons/csv/CSVFormatTest.java b/src/test/java/org/apache/commons/csv/CSVFormatTest.java index 6719571b..a8f79f99 100644 --- a/src/test/java/org/apache/commons/csv/CSVFormatTest.java +++ b/src/test/java/org/apache/commons/csv/CSVFormatTest.java @@ -30,10 +30,12 @@ import static org.junit.Assert.assertTrue; 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; /** @@ -374,6 +376,20 @@ public class CSVFormatTest { assertFalse(Arrays.equals(formatWithHeader.getHeader(), header)); } + @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());