### Question:
StringPropertyReplacer { public static String replaceProperties(final String string) { return replaceProperties(string, (Properties) null); }  static String replaceProperties(final String string); static String replaceProperties(final String string, final Properties props); static String replaceProperties(final String string, PropertyResolver resolver); static final String NEWLINE; }### Answer:
@Test public void testSystemProperties() throws NoSuchAlgorithmException { System.setProperty("prop1", "val1"); Assert.assertEquals("foo-val1", StringPropertyReplacer.replaceProperties("foo-${prop1}")); Assert.assertEquals("foo-def", StringPropertyReplacer.replaceProperties("foo-${prop2:def}")); System.setProperty("prop2", "val2"); Assert.assertEquals("foo-val2", StringPropertyReplacer.replaceProperties("foo-${prop2:def}")); Assert.assertEquals("foo-def", StringPropertyReplacer.replaceProperties("foo-${prop3:${prop4:${prop5:def}}}")); System.setProperty("prop5", "val5"); Assert.assertEquals("foo-val5", StringPropertyReplacer.replaceProperties("foo-${prop3:${prop4:${prop5:def}}}")); System.setProperty("prop4", "val4"); Assert.assertEquals("foo-val4", StringPropertyReplacer.replaceProperties("foo-${prop3:${prop4:${prop5:def}}}")); System.setProperty("prop3", "val3"); Assert.assertEquals("foo-val3", StringPropertyReplacer.replaceProperties("foo-${prop3:${prop4:${prop5:def}}}")); Assert.assertEquals("foo-def", StringPropertyReplacer.replaceProperties("foo-${prop6,prop7:def}")); System.setProperty("prop7", "val7"); Assert.assertEquals("foo-val7", StringPropertyReplacer.replaceProperties("foo-${prop6,prop7:def}")); System.setProperty("prop6", "val6"); Assert.assertEquals("foo-val6", StringPropertyReplacer.replaceProperties("foo-${prop6,prop7:def}")); }