PropertiesProviderSelector { public PropertiesProvider getProvider(String filename) { if (filename.endsWith(".yaml") || filename.endsWith(".yml")) { return yamlProvider; } else if (filename.endsWith(".json")) { return jsonProvider; } else { return propertiesProvider; } } PropertiesProviderSelector(PropertiesProvider propertiesProvider, PropertiesProvider yamlProvider, PropertiesProvider jsonProvider); PropertiesProvider getProvider(String filename);  }
@Test void returnsYamlProviderForYaml() { assertThat(selector.getProvider("test.yaml")).isEqualTo(yamlProvider); }
@Test void returnsYamlProviderForYml() { assertThat(selector.getProvider("test.yml")).isEqualTo(yamlProvider); }
@Test void returnsJsonProviderForJson() { assertThat(selector.getProvider("test.json")).isEqualTo(jsonProvider); }
@Test void returnsPropertiesProviderForNonYaml() { assertThat(selector.getProvider("test.properties")).isEqualTo(propertiesProvider); }