@Test public void stringQuotationShouldCorrectlyQuote() { assertEquals("\"sample\"", Address.quoteString("sample")); assertEquals("\"\"sample\"\"", Address.quoteString("\"\"sample\"\"")); assertEquals("\"sample\"", Address.quoteString("\"sample\"")); assertEquals("\"sa\"mp\"le\"", Address.quoteString("sa\"mp\"le")); assertEquals("\"sa\"mp\"le\"", Address.quoteString("\"sa\"mp\"le\"")); assertEquals("\"\"\"", Address.quoteString("\"")); }
@VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } }
Address implements Serializable { @VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } } }
Address implements Serializable { @VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } } Address(Address address);  Address(String address, String personal);  Address(String address); private  Address(String address, String personal, boolean parse); }
Address implements Serializable { @VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } } Address(Address address);  Address(String address, String personal);  Address(String address); private  Address(String address, String personal, boolean parse); String getAddress(); String getHostname(); void setAddress(String address); String getPersonal(); void setPersonal(String newPersonal); static Address[] parseUnencoded(String addressList); static Address[] parse(String addressList); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static String toString(Address[] addresses); String toEncodedString(); static String toEncodedString(Address[] addresses); static Address[] unpack(String addressList); static String pack(Address[] addresses); static String quoteAtoms(final String text); }
Address implements Serializable { @VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } } Address(Address address);  Address(String address, String personal);  Address(String address); private  Address(String address, String personal, boolean parse); String getAddress(); String getHostname(); void setAddress(String address); String getPersonal(); void setPersonal(String newPersonal); static Address[] parseUnencoded(String addressList); static Address[] parse(String addressList); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static String toString(Address[] addresses); String toEncodedString(); static String toEncodedString(Address[] addresses); static Address[] unpack(String addressList); static String pack(Address[] addresses); static String quoteAtoms(final String text);  }