### Question:
YamlConfigSource extends MapConfigSource { static String escapeAndJoin(Collection<?> data) { return data.stream() .map(e -> e.toString().replace(",", "\\,")) .collect(Collectors.joining(",")); } YamlConfigSource(String name, Map<String, ?> tree, int defaultOrdinal); static YamlConfigSource of(URL url, int defaultOrdinal);  }### Answer:
@Test public void testEscapeAndJoinOneItemNoEscape() { String result = YamlConfigSource.escapeAndJoin(new ArrayList<String>() {{ add("one"); }}); assertThat(result).isEqualTo("one"); }
@Test public void testEscapeAndJoinOneItemWithEscape() { String result = YamlConfigSource.escapeAndJoin(new ArrayList<String>() {{ add("one,two"); }}); assertThat(result).isEqualTo("one\\,two"); }
@Test public void testEscapeAndJoinTwoItemsNoEscape() { String result = YamlConfigSource.escapeAndJoin(new ArrayList<String>() {{ add("one"); add("two"); }}); assertThat(result).isEqualTo("one,two"); }
@Test public void testEscapeAndJoinTwoItemsWithEscape() { String result = YamlConfigSource.escapeAndJoin(new ArrayList<String>() {{ add("one,two"); add("three"); }}); assertThat(result).isEqualTo("one\\,two,three"); }