PropertiesSettingsProvider implements SettingsProvider { @Override public List<String> getList(String settingName, List<String> defaultValue) { Optional<String> stringCandidate = get(settingName); return stringCandidate.isPresent() ? Arrays.asList(stringCandidate.get().split(COMMA)) : defaultValue; } PropertiesSettingsProvider(Properties properties); @Override Optional<String> get(String settingName); @Override List<String> getList(String settingName, List<String> defaultValue); @Override Optional<T> getAs(String settingName, Class<T> cls);  }
@Test public void testGetList() throws Exception { assertThat(settingsProvider.getList(MISSING_KEY, Collections.emptyList()), is(empty())); assertThat(settingsProvider.getList(MISSING_KEY, Arrays.asList("1", "2")), contains("1", "2")); assertThat(settingsProvider.getList(EXISTING_KEY, Collections.emptyList()), contains("1", "2", "3")); }