### Question:
InMemoryOverrideSource implements OverrideSource { static Builder builder(Map<String, String> overrideValues) { return new Builder(overrideValues.entrySet() .stream() .map(e -> new AbstractMap.SimpleEntry<>(e.getKey(), e.getValue())) .collect(Collectors.toList())); } private  InMemoryOverrideSource(Builder builder); @Override Optional<OverrideContent> load();  }### Answer:
@Test public void testWildcards() { Config config = Config.builder() .sources(ConfigSources.create( Map.of( "aaa.bbb.name", "app-name", "aaa.bbb.url", "URL0", "aaa.anything", "1", "bbb", "ahoy" ))) .overrides(OverrideSources.create(Map.of("*.*.url", "URL1"))) .disableEnvironmentVariablesSource() .disableSystemPropertiesSource() .build(); assertThat(config.get("aaa.bbb.name").asString(), is(ConfigValues.simpleValue("app-name"))); assertThat(config.get("aaa.bbb.url").asString().get(), is("URL1")); assertThat(config.get("aaa.ccc.url").exists(), is(false)); assertThat(config.get("aaa.anything").asInt().get(), is(1)); assertThat(config.get("bbb").asString().get(), is("ahoy")); assertThat(config.get("bbb.ccc.url").exists(), is(false)); }
@Test public void testWildcards2() { Config config = Config.builder() .sources(ConfigSources.create( Map.of( "aaa.bbb.name", "app-name", "aaa.bbb.url", "URL0", "aaa.anything", "1", "bbb", "ahoy" ))) .overrides(OverrideSources.create(Map.of("*.url", "URL1"))) .disableEnvironmentVariablesSource() .disableSystemPropertiesSource() .build(); assertThat(config.get("aaa.bbb.name").asString(), is(ConfigValues.simpleValue("app-name"))); assertThat(config.get("aaa.bbb.url").asString(), is(ConfigValues.simpleValue("URL0"))); assertThat(config.get("aaa.ccc.url").exists(), is(false)); assertThat(config.get("aaa.anything").asInt(), is(ConfigValues.simpleValue(1))); assertThat(config.get("bbb").asString(), is(ConfigValues.simpleValue("ahoy"))); assertThat(config.get("bbb.ccc.url").exists(), is(false)); }
@Test public void testAsConfigFilter() { Config config = Config.builder() .sources(ConfigSources.create( Map.of( "aaa.bbb.name", "app-name", "aaa.bbb.url", "URL0", "aaa.anything", "1", "bbb", "ahoy" ))) .addFilter(new OverrideConfigFilter(() -> OverrideSource.OverrideData.createFromWildcards( Map.of("*.*.url", "URL1") .entrySet() .stream() .map(e -> new AbstractMap.SimpleEntry<>(e.getKey(), e.getValue())) .collect(Collectors.toList())).data())) .disableEnvironmentVariablesSource() .disableSystemPropertiesSource() .build(); assertThat(config.get("aaa.bbb.name").asString(), is(ConfigValues.simpleValue("app-name"))); assertThat(config.get("aaa.bbb.url").asString(), is(ConfigValues.simpleValue("URL1"))); assertThat(config.get("aaa.ccc.url").exists(), is(false)); assertThat(config.get("aaa.anything").asInt(), is(ConfigValues.simpleValue(1))); assertThat(config.get("bbb").asString(), is(ConfigValues.simpleValue("ahoy"))); assertThat(config.get("bbb.ccc.url").exists(), is(false)); }