@Test
public void shouldReplaceVariablesWithBackSlashesAndShouldWorkWithRecursion() {

    Properties values = new Properties();
    values.setProperty("color", "bro\\wn");
    values.setProperty("animal", "qui\\ck\\${color}\\fo\\x");
    values.setProperty("target.attribute", "la\\zy");
    values.setProperty("target.animal", "do\\g");
    values.setProperty("target", "${target.attribute}\\${target.animal}");
    values.setProperty("template", "The ${animal} jum\\ped over the ${target}.");
    values.setProperty("wrapper", "\\foo\\${template}\\bar\\");
    values.setProperty("wrapper2", "\\baz\\${wrapper}\\qux\\");
    StrSubstitutor sub = new StrSubstitutor(values);
    String resolvedString = sub.replace("${wrapper2}");
    assertEquals("\\baz\\\\foo\\The qui\\ck\\bro\\wn\\fo\\x jum\\ped over the la\\zy\\do\\g.\\bar\\\\qux\\",
            resolvedString);
}