### Question:
OverrideConfigFilter implements ConfigFilter { @Override public String apply(Config.Key key, String stringValue) { List<Map.Entry<Predicate<Config.Key>, String>> overrideValues = overrideValuesSupplier.get(); if (overrideValues != null) { for (Map.Entry<Predicate<Config.Key>, String> entry : overrideValues) { if (entry.getKey().test(key)) { return entry.getValue(); } } } return stringValue; } OverrideConfigFilter(Supplier<List<Map.Entry<Predicate<Config.Key>, String>>> overrideValuesSupplier); @Override String apply(Config.Key key, String stringValue);  }### Answer:
@Test public void testCreateFilterWithNullParam() { OverrideConfigFilter filter = new OverrideConfigFilter(() -> null); assertThat(filter, notNullValue()); assertThat(filter.apply(Config.Key.create("name"), "ondrej"), is("ondrej")); }
@Test public void testCreateFilterWithEmptyParam() { OverrideConfigFilter filter = new OverrideConfigFilter(List::of); assertThat(filter, notNullValue()); assertThat(filter.apply(Config.Key.create("name"), "ondrej"), is("ondrej")); }
@Test public void testCreateFilterWithParam() { OverrideConfigFilter filter = new OverrideConfigFilter(() -> OverrideSource.OverrideData.createFromWildcards( ORDERED_MAP .entrySet() .stream() .map(e -> new AbstractMap.SimpleEntry<>(e.getKey(), e.getValue())) .collect(Collectors.toList())).data()); assertThat(filter, notNullValue()); assertThat(filter.apply(Config.Key.create("name"), "ondrej"), is("libor")); }
@Test public void testWithRegexizeFunction() { OverrideConfigFilter filter = new OverrideConfigFilter(() -> OverrideSource.OverrideData.createFromWildcards( ORDERED_MAP .entrySet() .stream() .map(e -> new AbstractMap.SimpleEntry<>(e.getKey(), e.getValue())) .collect(Collectors.toList())).data()); assertThat(filter, notNullValue()); assertThat(filter.apply(Config.Key.create("name"), "ondrej"), is("libor")); }