Test CSV-154.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1700391 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2015-09-01 05:33:05 +00:00
parent 68c74f6274
commit 1d5dfcb8f6
1 changed files with 15 additions and 3 deletions

View File

@ -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");