@Test
public void testNotSetEnv() {

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