### Question:
PropertiesConfigurationParser extends AbstractConfigurationParser { static int evaluatePropertyValuesInternal(Properties props) { final Pattern pattern = Pattern.compile("(#|\\$)\\{[^\\}]*\\}"); int replaceCount = 0; for (Map.Entry<Object, Object> me : props.entrySet()) { if (me.getKey() == null || me.getValue() == null) { continue; } String input = me.getValue().toString(); Matcher matcher = pattern.matcher(input); String result = input; int offset = 0; while (matcher.find(offset)) { offset = matcher.start() + 1; String group = matcher.group(); String replacement = group.substring(2, group.length() - 1); if (replacement.length() > 0) { String nv = System.getProperty(replacement); if (nv == null) { nv = System.getenv(replacement); } if (nv == null) { nv = props.getProperty(replacement); } if (nv != null) { replacement = nv; } else { throw new IllegalArgumentException("Cannot resolve configuration expression '" + replacement + "' for key '" + me.getKey() + "'"); } } if (!group.equals(replacement)) { result = StringUtils.replace(result, group, replacement); matcher = pattern.matcher(result); replaceCount++; offset = offset + replacement.length() - 1; } } me.setValue(result); } return replaceCount; }  Collection<ConfigurationEntry> parse(File baseDir, InputStream input);  }### Answer:
@Test public void testEvaluatePropertyValuesInternal1() throws Exception { Properties p = new Properties(); p.setProperty("a", "A"); p.setProperty("b", "1${a}2"); PropertiesConfigurationParser.evaluatePropertyValuesInternal(p); assertEquals("1A2", p.getProperty("b")); }
@Test(expected = IllegalArgumentException.class) public void testEvaluatePropertyValuesInternalIllegalArgument() throws Exception { Properties p = new Properties(); p.setProperty("b", "1${a384z}2"); PropertiesConfigurationParser.evaluatePropertyValuesInternal(p); }