ArrayLogParam implements LogParam { @Override public void append(StringBuilder builder, Set<String> maskedFields, int maxParamLength) { int maxLength = builder.length() + maxParamLength; builder.append('['); for (int i = 0; i < values.length; i++) { String value = values[i]; if (i > 0) builder.append(", "); builder.append(value); if (builder.length() >= maxLength) { builder.setLength(maxLength); builder.append("...(truncated)"); return; } } builder.append(']'); } ArrayLogParam(String... values); @Override void append(StringBuilder builder, Set<String> maskedFields, int maxParamLength);  }
@Test void append() { var param = new ArrayLogParam("1", "2", "3"); var builder = new StringBuilder(); param.append(builder, Set.of(), 1000); assertThat(builder.toString()) .isEqualTo("[1, 2, 3]"); }
@Test void appendWithTruncation() { var param = new ArrayLogParam("1", "2", "3"); var builder = new StringBuilder(); param.append(builder, Set.of(), 5); assertThat(builder.toString()) .isEqualTo("[1, 2...(truncated)"); }