@Test
public void testSetEnv() {

    Assert.assertEquals("false", StringPropertyReplacer.replaceProperties("${<set>env._DOESNT_EXIST}"));
    Assert.assertEquals("false", StringPropertyReplacer.replaceProperties("${notexist,<set>env._DOESNT_EXIST}"));
    String envvar = System.getenv().keySet().iterator().next(); // just pick a env var to use
    Assert.assertEquals("true",
            StringPropertyReplacer.replaceProperties(String.format("${<set>env.%s}", envvar)));
    Assert.assertEquals("true",
            StringPropertyReplacer.replaceProperties(String.format("${notexist,<set>env.%s}", envvar)));
    try {
        StringPropertyReplacer.replaceProperties("${<set>env._DOESNT_EXIST,foo}");
        Assert.fail("Should not be able to specify composite key when using set");
    } catch (IllegalArgumentException expected) {
    }
    try {
        StringPropertyReplacer.replaceProperties("${<set>env._DOESNT_EXIST:blah}");
        Assert.fail("Should not be able to specify default value when using set");
    } catch (IllegalArgumentException expected) {
    }
}