HerdStringHelper { public List<String> getDelimitedConfigurationValue(ConfigurationValue configurationValue) { return splitStringWithDefaultDelimiter(configurationHelper.getProperty(configurationValue)); }  List<String> splitStringWithDefaultDelimiter(String inputString); List<String> splitStringWithDefaultDelimiterEscaped(String inputString); String getRequiredConfigurationValue(ConfigurationValue configurationValue); int getConfigurationValueAsInteger(ConfigurationValue configurationValue); String getConfigurationValueAsString(ConfigurationValue configurationValue); Set<String> splitAndTrim(String string, String delimiter); String join(List<String> list, String delimiter, String escapeSequence); List<String> getDelimitedConfigurationValue(ConfigurationValue configurationValue); String buildStringWithDefaultDelimiter(List<String> inputStrings);  }
@Test public void testGetDelimitedConfigurationValueAssertResultIsDelimited() throws Exception { Map<String, Object> overrideMap = new HashMap<>(); overrideMap.put(ConfigurationValue.EMR_SPOT_PRICE_HISTORY_PRODUCT_DESCRIPTIONS.getKey(), "a|b|c"); modifyPropertySourceInEnvironment(overrideMap); try { List<String> actualList = herdStringHelper.getDelimitedConfigurationValue(ConfigurationValue.EMR_SPOT_PRICE_HISTORY_PRODUCT_DESCRIPTIONS); assertEquals(Arrays.asList("a", "b", "c"), actualList); } finally { restorePropertySourceInEnvironment(); } }
@Test public void testGetDelimitedConfigurationValueWhenValueIsNullAssertResultIsEmpty() throws Exception { Map<String, Object> overrideMap = new HashMap<>(); overrideMap.put(ConfigurationValue.EMR_SPOT_PRICE_HISTORY_PRODUCT_DESCRIPTIONS.getKey(), null); modifyPropertySourceInEnvironment(overrideMap); try { List<String> actualList = herdStringHelper.getDelimitedConfigurationValue(ConfigurationValue.EMR_SPOT_PRICE_HISTORY_PRODUCT_DESCRIPTIONS); assertEquals(Arrays.asList(), actualList); } finally { restorePropertySourceInEnvironment(); } }
@Test public void testGetDelimitedConfigurationValueWhenValueIsEmptyAssertResultIsEmpty() throws Exception { Map<String, Object> overrideMap = new HashMap<>(); overrideMap.put(ConfigurationValue.EMR_SPOT_PRICE_HISTORY_PRODUCT_DESCRIPTIONS.getKey(), ""); modifyPropertySourceInEnvironment(overrideMap); try { List<String> actualList = herdStringHelper.getDelimitedConfigurationValue(ConfigurationValue.EMR_SPOT_PRICE_HISTORY_PRODUCT_DESCRIPTIONS); assertEquals(Arrays.asList(), actualList); } finally { restorePropertySourceInEnvironment(); } }