diff --git a/src/test/java/org/apache/commons/csv/CSVFormatTest.java b/src/test/java/org/apache/commons/csv/CSVFormatTest.java index a8f79f99..e0a5fa3a 100644 --- a/src/test/java/org/apache/commons/csv/CSVFormatTest.java +++ b/src/test/java/org/apache/commons/csv/CSVFormatTest.java @@ -377,10 +377,22 @@ public class CSVFormatTest { } @Test - public void testJIraCsv154() throws IOException { + public void testJiraCsv154_withCommentMarker() throws IOException { final String comment = "This is a header comment"; - CSVFormat format = CSVFormat.EXCEL.withHeader("H1", "H2").withCommentMarker('#') - .withHeaderComments(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 testJiraCsv154_withHeaderComments() throws IOException { + final String comment = "This is a header comment"; + CSVFormat format = CSVFormat.EXCEL.withHeader("H1", "H2").withHeaderComments(comment).withCommentMarker('#'); StringBuilder out = new StringBuilder(); final CSVPrinter printer = format.print(out); printer.print("A");