CodeBuilder { public CodeBuilder appendCommaSeparatedValues(List<String> values) { int index = 0; for (String value : values) { if (index > 0) builder.append(", "); builder.append(value); index++; } return this; }  CodeBuilder append(String text); CodeBuilder append(char ch); CodeBuilder append(String pattern, Object... argument); CodeBuilder appendCommaSeparatedValues(List<String> values); CodeBuilder indent(int indent); String build();  }
@Test void appendCommaSeparatedValues() { CodeBuilder builder = new CodeBuilder(); builder.appendCommaSeparatedValues(List.of("item1", "item2")); assertThat(builder.build()).isEqualTo("item1, item2"); }