### Question:
YamlConfigSource extends MapConfigSource { static Map<String, String> flatten(Map<String, ?> tree) { Map<String, String> map = new HashMap<>(); flatten(map, null, tree); return map; } YamlConfigSource(String name, Map<String, ?> tree, int defaultOrdinal); static YamlConfigSource of(URL url, int defaultOrdinal);  }### Answer:
@Test public void testFlattenSimple() { Map<String, ?> tree = new HashMap<String, Object>() {{ put("a_string", "taco"); put("an_integer", 22); put("a_boolean", true); }}; Map<String, String> map = YamlConfigSource.flatten(tree); assertThat(map).hasSize(3); assertThat(map.get("a_string")).isEqualTo("taco"); assertThat(map.get("an_integer")).isEqualTo("22"); assertThat(map.get("a_boolean")).isEqualTo("true"); }
@Test public void testFlattenNested() { Map<String, ?> tree = new HashMap<String, Object>() {{ put("a_string", "taco"); put("an_integer", 22); put("a_boolean", true); put( "sub", new HashMap<String,Object>() {{ put( "a_string", "cheese"); }}); }}; Map<String, String> map = YamlConfigSource.flatten(tree); assertThat(map).hasSize(4); assertThat(map.get("a_string")).isEqualTo("taco"); assertThat(map.get("an_integer")).isEqualTo("22"); assertThat(map.get("a_boolean")).isEqualTo("true"); assertThat(map.get("sub.a_string")).isEqualTo("cheese"); }