@Test void getConfigurationShouldReturnFirstExistingFile() throws Exception { assertThat(testee.getConfigurations("a", "b").getString("prop")) .isEqualTo("value1"); }
public Configuration getConfigurations(String... filenames) throws FileNotFoundException, ConfigurationException { File file = Arrays.stream(filenames) .map(this::getConfigurationFile) .flatMap(Optional::stream) .findFirst() .orElseThrow(() -> new FileNotFoundException(Joiner.on(",").join(filenames) + " not found")); return getConfiguration(file); }
PropertiesProvider { public Configuration getConfigurations(String... filenames) throws FileNotFoundException, ConfigurationException { File file = Arrays.stream(filenames) .map(this::getConfigurationFile) .flatMap(Optional::stream) .findFirst() .orElseThrow(() -> new FileNotFoundException(Joiner.on(",").join(filenames) + " not found")); return getConfiguration(file); } }
PropertiesProvider { public Configuration getConfigurations(String... filenames) throws FileNotFoundException, ConfigurationException { File file = Arrays.stream(filenames) .map(this::getConfigurationFile) .flatMap(Optional::stream) .findFirst() .orElseThrow(() -> new FileNotFoundException(Joiner.on(",").join(filenames) + " not found")); return getConfiguration(file); } @Inject  PropertiesProvider(FileSystem fileSystem, ConfigurationPath configurationPrefix); }
PropertiesProvider { public Configuration getConfigurations(String... filenames) throws FileNotFoundException, ConfigurationException { File file = Arrays.stream(filenames) .map(this::getConfigurationFile) .flatMap(Optional::stream) .findFirst() .orElseThrow(() -> new FileNotFoundException(Joiner.on(",").join(filenames) + " not found")); return getConfiguration(file); } @Inject  PropertiesProvider(FileSystem fileSystem, ConfigurationPath configurationPrefix); Configuration getConfigurations(String... filenames); Configuration getConfiguration(String fileName); }
PropertiesProvider { public Configuration getConfigurations(String... filenames) throws FileNotFoundException, ConfigurationException { File file = Arrays.stream(filenames) .map(this::getConfigurationFile) .flatMap(Optional::stream) .findFirst() .orElseThrow(() -> new FileNotFoundException(Joiner.on(",").join(filenames) + " not found")); return getConfiguration(file); } @Inject  PropertiesProvider(FileSystem fileSystem, ConfigurationPath configurationPrefix); Configuration getConfigurations(String... filenames); Configuration getConfiguration(String fileName);  }