### Question:
HammockConfigSourceProvider implements ConfigSourceProvider { @Override public List<ConfigSource> getConfigSources(ClassLoader classLoader) { List<ConfigSource> configSources = new ArrayList<>(); ConfigSource cli = CLIPropertySource.parseMainArgs(Bootstrap.ARGS); configSources.add(cli); String propertyValue = cli.getValue("hammock.external.config"); if(propertyValue != null) { try { URL url = Paths.get(propertyValue).toUri().toURL(); configSources.add(new PropertyFileConfigSource(url)); } catch (MalformedURLException e) { throw new RuntimeException("Unable to load "+propertyValue,e); } } for(String prop : defaultPropertyFiles) { configSources.addAll(new PropertyFileConfigSourceProvider(prop, true, classLoader).getConfigSources(classLoader)); } return configSources; }  @Override List<ConfigSource> getConfigSources(ClassLoader classLoader);  }### Answer:
@Test public void shouldCreateTwoConfigSourcesWhenPropertyConfigured() { Bootstrap.ARGS = new String[]{"--hammock.external.config=src/test/resources/testing.properties"}; HammockConfigSourceProvider hammockConfigSourceProvider = new HammockConfigSourceProvider(); assertEquals(2,hammockConfigSourceProvider.getConfigSources(getClass().getClassLoader()).size()); }
@Test public void shouldOnlyCreateOneConfigSource() { Bootstrap.ARGS = new String[]{"--cli=true"}; HammockConfigSourceProvider hammockConfigSourceProvider = new HammockConfigSourceProvider(); assertEquals(1,hammockConfigSourceProvider.getConfigSources(getClass().getClassLoader()).size()); }
@Test public void shouldHaveCorrectPropertiesInFile() { Bootstrap.ARGS = new String[]{"--hammock.external.config=src/test/resources/testing.properties"}; HammockConfigSourceProvider hammockConfigSourceProvider = new HammockConfigSourceProvider(); ConfigSource configSource = hammockConfigSourceProvider.getConfigSources(getClass().getClassLoader()).get(1); assertEquals("1492", configSource.getValue("something.random")); }