CSVUtils { @Contract("null -> null; !null -> !null") public static String escapeDoubleQuote(String value) { if (value == null) { return null; } return value.replaceAll("\"", "\"\""); } private  CSVUtils(); @Contract("null -> null") static String getEscapedValueForCsv(String value); @Contract("null -> null; !null -> !null") static String escapeDoubleQuote(String value); @Contract(value = "null -> null; !null -> !null", pure = true) static String quoteString(String value);  }
@Test public void testEscapeDoubleQuote() { Assert.assertNull(CSVUtils.escapeDoubleQuote(null)); Assert.assertEquals("", CSVUtils.escapeDoubleQuote("")); Assert.assertEquals("no quotes", CSVUtils.escapeDoubleQuote("no quotes")); Assert.assertEquals("string with \"\"quotes\"\"", CSVUtils.escapeDoubleQuote("string with \"quotes\"")); }