@Test @Ignore public void testJira135All() throws IOException { final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote(DQUOTE_CHAR).withEscape(BACKSLASH_CH); final StringWriter sw = new StringWriter(); final List<String> list = new LinkedList<>(); try (final CSVPrinter printer = new CSVPrinter(sw, format)) { list.add("\""); list.add("\n"); list.add("\\"); printer.printRecord(list); } final String expected = "\"\\\"\",\"\\n\",\"\\\"" + format.getRecordSeparator(); assertEquals(expected, sw.toString()); final String[] record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(list.toArray(), format), record0); }
@Test @Ignore public void testJira135_part1() throws IOException { final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote(DQUOTE_CHAR).withEscape(BACKSLASH_CH); final StringWriter sw = new StringWriter(); final List<String> list = new LinkedList<>(); try (final CSVPrinter printer = new CSVPrinter(sw, format)) { list.add("\""); printer.printRecord(list); } final String expected = "\"\\\"\"" + format.getRecordSeparator(); assertEquals(expected, sw.toString()); final String[] record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(list.toArray(), format), record0); }
@Test @Ignore public void testJira135_part2() throws IOException { final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote(DQUOTE_CHAR).withEscape(BACKSLASH_CH); final StringWriter sw = new StringWriter(); final List<String> list = new LinkedList<>(); try (final CSVPrinter printer = new CSVPrinter(sw, format)) { list.add("\n"); printer.printRecord(list); } final String expected = "\"\\n\"" + format.getRecordSeparator(); assertEquals(expected, sw.toString()); final String[] record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(list.toArray(), format), record0); }
@Test @Ignore public void testJira135_part3() throws IOException { final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote(DQUOTE_CHAR).withEscape(BACKSLASH_CH); final StringWriter sw = new StringWriter(); final List<String> list = new LinkedList<>(); try (final CSVPrinter printer = new CSVPrinter(sw, format)) { list.add("\\"); printer.printRecord(list); } final String expected = "\"\\\\\"" + format.getRecordSeparator(); assertEquals(expected, sw.toString()); final String[] record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(list.toArray(), format), record0); }
String[] record0 = toFirstRecordValues(expected, format); assertArrayEquals(new Object[2], record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0);
String[] record0 = toFirstRecordValues(expected, format); assertArrayEquals(new Object[2], record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0);
String[] record0 = toFirstRecordValues(expected, format); assertArrayEquals(new Object[2], record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0); record0 = toFirstRecordValues(expected, format); assertArrayEquals(expectNulls(s, format), record0);