LogFilter { void truncate(StringBuilder builder, String value, int maxLength) { if (value.length() > maxLength) { builder.append(value, 0, maxLength); builder.append("...(truncated)"); } else { builder.append(value); } }  void append(StringBuilder builder, String message, Object... arguments); final Set<String> maskedFields; }
@Test void truncate() { var builder = new StringBuilder(); filter.truncate(builder, "1234567890", 5); assertThat(builder.toString()).isEqualTo("12345...(truncated)"); }