PropertiesProvider { public Configuration getConfiguration(String fileName) throws FileNotFoundException, ConfigurationException { Preconditions.checkArgument(!Strings.isNullOrEmpty(fileName)); File file = getConfigurationFile(fileName) .orElseThrow(() -> new FileNotFoundException(fileName)); return getConfiguration(file); } @Inject  PropertiesProvider(FileSystem fileSystem, ConfigurationPath configurationPrefix); Configuration getConfigurations(String... filenames); Configuration getConfiguration(String fileName);  }
@Test void getConfigurationShouldThrowWhenNotExistingFile() { assertThatThrownBy(() -> testee.getConfiguration("d")) .isInstanceOf(FileNotFoundException.class); }
@Test void getConfigurationShouldLoadProperties() throws Exception { assertThat(testee.getConfiguration("a").getString("prop")) .isEqualTo("value1"); }
@Test void getConfigurationShouldLoadListValues() throws Exception { assertThat(testee.getConfiguration("a").getList(String.class, "keyByList")) .containsExactly("value1", "value2", "value3", "value4", "value5"); }
@Test void getStringArrayShouldReturnEmptyArrayWhenKeyNotFound() throws Exception { assertThat(testee.getConfiguration("a").getStringArray("notExistKey")) .isEmpty(); }
@Test void getListShouldReturnEmptyListWhenKeyNotFound() throws Exception { assertThat(testee.getConfiguration("a").getList("notExistKey")) .isEmpty(); }