TextUtils { public static String escape(char ch) { for (int i = 0; i < ESCAPE.length; i++) { if (ESCAPE[i] == ch) { return ESCAPED[i]; } } return String.valueOf(ch); } private  TextUtils(); static String escape(char ch); static String trimTrailingLineSeparatorFrom(String string); static final char CR; static final char LF; }
@Test public void should_escape() { assertThat(TextUtils.escape('\r')).isEqualTo("\\r"); assertThat(TextUtils.escape('\n')).isEqualTo("\\n"); assertThat(TextUtils.escape('\f')).isEqualTo("\\f"); assertThat(TextUtils.escape('\t')).isEqualTo("\\t"); assertThat(TextUtils.escape('"')).isEqualTo("\\\""); assertThat(TextUtils.escape('\\')).isEqualTo("\\"); }