### Question:
PropertyPlaceholderHelper { public Properties replacePropertiesPlaceholder(Properties properties) { final Properties p = new Properties(); Set<String> keys = properties.stringPropertyNames(); for (String key : keys) { p.setProperty(key, replacePlaceholder(properties.getProperty(key))); } return p; } PropertyPlaceholderHelper(Map<String, String> properties, String regex); String getPropertyValue(String key); Properties replacePropertiesPlaceholder(Properties properties); String replacePlaceholder(String value); Pattern getPattern(); final static String ENV_REGEX; }### Answer:
@Test public void testReplacePropertiesPlaceholder() { System.out.println("replacePropertiesPlaceholder"); Properties props = new Properties(); props.setProperty("testEnvironmentHandlersProperties", "${ENV=testEnvironmentHandlers}"); props.setProperty("testEnvironmentHandlerServicesProperties", "${ENV=testEnvironmentHandlerServices}"); Properties expResultProps = new Properties(); expResultProps.setProperty("testEnvironmentHandlersProperties", "java.util.logging.ConsoleHandler"); expResultProps.setProperty("testEnvironmentHandlerServicesProperties", "com.sun.enterprise.server.logging.GFFileHandler,com.sun.enterprise.server.logging.SyslogHandler"); PropertyPlaceholderHelper propertyPlaceholderHelper = new PropertyPlaceholderHelper(env, PropertyPlaceholderHelper.ENV_REGEX); Properties result = propertyPlaceholderHelper.replacePropertiesPlaceholder(props); assertEquals(expResultProps.getProperty("testEnvironmentHandlersProperties"), result.getProperty("testEnvironmentHandlersProperties")); assertEquals(expResultProps.getProperty("testEnvironmentHandlerServicesProperties"), result.getProperty("testEnvironmentHandlerServicesProperties")); }