Add testRfc4180QuoteSingleChar().

This commit is contained in:
Gary Gregory 2016-07-31 00:29:29 -07:00
parent 190390bf5d
commit fa437cb924
1 changed files with 10 additions and 0 deletions

View File

@ -53,6 +53,7 @@ import org.junit.Test;
*/ */
public class CSVPrinterTest { public class CSVPrinterTest {
private static final char EURO_CH = '\u20AC';
private static final char DQUOTE_CHAR = '"'; private static final char DQUOTE_CHAR = '"';
private static final char BACKSLASH_CH = '\\'; private static final char BACKSLASH_CH = '\\';
private static final char QUOTE_CH = '\''; private static final char QUOTE_CH = '\'';
@ -806,6 +807,15 @@ public class CSVPrinterTest {
} }
} }
@Test
public void testRfc4180QuoteSingleChar() throws IOException {
final StringWriter sw = new StringWriter();
try (final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.RFC4180)) {
printer.printRecord(EURO_CH, "Deux");
assertEquals("\"" + EURO_CH + "\",Deux" + recordSeparator, sw.toString());
}
}
@Test @Test
public void testPrinter2() throws IOException { public void testPrinter2() throws IOException {
final StringWriter sw = new StringWriter(); final StringWriter sw = new StringWriter();