LogSanitizerUtil { public static String sanitize(String original) { String cleaned = original.replace("\r","|") .replace("\n","|") .replace("\t","|"); if (!cleaned.equals(original)) { cleaned += SANITIZED_FLAG; } return cleaned; }  static String sanitize(String original); static final String SANITIZED_FLAG; }
@Test public void testSanitizeInput() { assertEquals(LogSanitizerUtil.sanitize("one\ntwo\tthree\rfour"), "one|two|three|four[SANITIZED]"); }
@Test public void testSanitizeCleanInput() { assertEquals(LogSanitizerUtil.sanitize("one two three four"), "one two three four"); }