HerdStringHelper { public String getRequiredConfigurationValue(ConfigurationValue configurationValue) { String value = configurationHelper.getProperty(configurationValue); if (StringUtils.isBlank(value)) { throw new IllegalStateException(String.format("Missing configuration parameter value for key \"%s\".", configurationValue.getKey())); } return value; }  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 testGetRequiredConfigurationValue() throws Exception { Map<String, Object> overrideMap = new HashMap<>(); overrideMap.put(ConfigurationValue.ACTIVITI_JOB_DEFINITION_ID_TEMPLATE.getKey(), STRING_VALUE); modifyPropertySourceInEnvironment(overrideMap); try { String resultValue = herdStringHelper.getRequiredConfigurationValue(ConfigurationValue.ACTIVITI_JOB_DEFINITION_ID_TEMPLATE); assertEquals(STRING_VALUE, resultValue); } finally { restorePropertySourceInEnvironment(); } }
@Test public void testGetRequiredConfigurationValueBlank() throws Exception { Map<String, Object> overrideMap = new HashMap<>(); overrideMap.put(ConfigurationValue.ACTIVITI_JOB_DEFINITION_ID_TEMPLATE.getKey(), BLANK_TEXT); modifyPropertySourceInEnvironment(overrideMap); try { herdStringHelper.getRequiredConfigurationValue(ConfigurationValue.ACTIVITI_JOB_DEFINITION_ID_TEMPLATE); fail("Suppose to throw an IllegalStateException when encrypted configuration value is blank."); } catch (IllegalStateException e) { assertEquals( String.format("Missing configuration parameter value for key \"%s\".", ConfigurationValue.ACTIVITI_JOB_DEFINITION_ID_TEMPLATE.getKey()), e.getMessage()); } finally { restorePropertySourceInEnvironment(); } }