@Test public void toStringValue() { assertEquals(null, ToStringHelper.toStringValue(null)); assertEquals("", ToStringHelper.toStringValue("")); assertEquals("abc", ToStringHelper.toStringValue("abc")); assertEquals("01234567890123456789...", ToStringHelper.toStringValue(Strings.repeat("0123456789", 10))); assertEquals("a\\r\\n\\tb", ToStringHelper.toStringValue("a\r\n\tb")); }
public static String toStringValue(String text) { if (text == null) { return text; } String stringValue = text; if (stringValue.length() > 20) { stringValue = stringValue.substring(0, STRING_MAX_LENGTH) + ELIPSES; } return stringValue.replace("\t", "\\t").replace("\n", "\\n").replace("\r", "\\r"); }
ToStringHelper { public static String toStringValue(String text) { if (text == null) { return text; } String stringValue = text; if (stringValue.length() > 20) { stringValue = stringValue.substring(0, STRING_MAX_LENGTH) + ELIPSES; } return stringValue.replace("\t", "\\t").replace("\n", "\\n").replace("\r", "\\r"); } }
ToStringHelper { public static String toStringValue(String text) { if (text == null) { return text; } String stringValue = text; if (stringValue.length() > 20) { stringValue = stringValue.substring(0, STRING_MAX_LENGTH) + ELIPSES; } return stringValue.replace("\t", "\\t").replace("\n", "\\n").replace("\r", "\\r"); } private  ToStringHelper(); }
ToStringHelper { public static String toStringValue(String text) { if (text == null) { return text; } String stringValue = text; if (stringValue.length() > 20) { stringValue = stringValue.substring(0, STRING_MAX_LENGTH) + ELIPSES; } return stringValue.replace("\t", "\\t").replace("\n", "\\n").replace("\r", "\\r"); } private  ToStringHelper(); static String toStringValue(String text); }
ToStringHelper { public static String toStringValue(String text) { if (text == null) { return text; } String stringValue = text; if (stringValue.length() > 20) { stringValue = stringValue.substring(0, STRING_MAX_LENGTH) + ELIPSES; } return stringValue.replace("\t", "\\t").replace("\n", "\\n").replace("\r", "\\r"); } private  ToStringHelper(); static String toStringValue(String text);  }