@Test
public void testGetConfiguration() throws Exception {

    
    // Redirect to a test Boot file
    String bootFile =
            URLDecoder.decode(JSONEnhancedConfigTest.class.getResource(
                    "/" + ServerConstants.DEFAULT_BOOT_FILE_LOCATION).getFile(), "UTF-8");
    System.setProperty(ServerConstants.PROPERTY_BOOT_FILE_LOCATION, bootFile);
    System.setProperty("system.environment", "TEST");
    IdentityServer.initInstance(new SystemPropertyAccessor(null));
    
    /*
     * {"attr1" : "&{property1}","attr2" : "pre &{property2}-post","attr3" :
     * "&{not-available}","attr4":{"subattr1" :
     * "nested &{env.&{environment}.variable}","subattr2" :
     * "nested &{env.&{system.environment}.variable}"},"attr5" :
     * "&{not-&{property1}","attr6" : "esc\\&{not-&{property1}}","attr7" :
     * "not-&{property1}}","attr8" :
     * "&{&{env-key}.DEMO.&{variable-key}}","attr9" :
     * "&{&{env-key}.PROD.&{variable-key}}","attr10" :
     * "&{&{inst-key}.DEMO.&{variable-key}}"}
     */
    String jsonConfigProperty =
            "{\"attr1\" : \"&{property1}\",\"attr2\" : \"pre &{property2}-post\",\"attr3\" : \"&{not-available}\",\"attr4\":{\"subattr1\" : \"nested &{env.&{environment}.variable}\",\"subattr2\" : \"nested &{env.&{system.environment}.variable}\"},\"attr5\" : \"&{not-&{property1}\",\"attr6\" : \"esc\\\\&{not-&{property1}}\",\"attr7\" : \"not-&{property1}}\",\"attr8\" : \"&{&{env-key}.DEMO.&{variable-key}}\",\"attr9\" : \"&{&{env-key}.PROD.&{variable-key}}\",\"attr10\" : \"&{&{inst-key}.DEMO.&{variable-key}}\"}";
    JSONEnhancedConfig enhancedConfig = new JSONEnhancedConfig();
    Dictionary<String, Object> dict = new Hashtable<String, Object>(1);
    dict.put(JSONEnhancedConfig.JSON_CONFIG_PROPERTY, jsonConfigProperty);
    JsonValue configuration = enhancedConfig.getConfiguration(dict, null, "pid", false);
    assertEquals(configuration.get("attr1").required().asString(), "value1");
    assertEquals(configuration.get("attr2").required().asString(), "pre value2-post");
    // assertEquals(configuration.get("attr3").required().asString(), "");
    assertEquals(configuration.get("attr3").required().asString(), "&{not-available}");
    JsonValue nested = configuration.get("attr4");
    assertFalse(nested.isNull());
    assertEquals(nested.get("subattr1").required().asString(), "nested DEMO");
    assertEquals(nested.get("subattr2").required().asString(), "nested TEST");
    assertEquals(configuration.get("attr5").required().asString(), "&{not-value1");
    assertEquals(configuration.get("attr6").required().asString(), "esc\\&{not-value1}");
    assertEquals(configuration.get("attr7").required().asString(), "not-value1}");
    assertEquals(configuration.get("attr8").required().asString(), "DEMO");
    assertEquals(configuration.get("attr9").required().asString(), "&{env.PROD.variable}");
    assertEquals(configuration.get("attr10").required().asString(),
            "&{&{inst-key}.DEMO.variable}");
}