* ConfigurationDeclaration.
*/
@Test
public void testConfigurationDeclarationGetAttributes()
{
HierarchicalConfiguration<?> config = new BaseHierarchicalConfiguration();
config.addProperty("xml.fileName", "test.xml");
ConfigurationDeclaration decl =
createDeclaration(config.configurationAt("xml"));
assertNull("Found an at attribute", decl.getAt());
assertFalse("Found an optional attribute", decl.isOptional());
config.addProperty("xml[@config-at]", "test1");
decl = createDeclaration(config.configurationAt("xml"));
assertEquals("Wrong value of at attribute", "test1", decl.getAt());
config.addProperty("xml[@at]", "test2");
decl = createDeclaration(config.configurationAt("xml"));
assertEquals("Wrong value of config-at attribute", "test1",
decl.getAt());
config.clearProperty("xml[@config-at]");
decl = createDeclaration(config.configurationAt("xml"));
assertEquals("Old at attribute not detected", "test2", decl.getAt());
config.addProperty("xml[@config-optional]", "true");
decl = createDeclaration(config.configurationAt("xml"));
assertTrue("Wrong value of optional attribute", decl.isOptional());
config.addProperty("xml[@optional]", "false");
decl = createDeclaration(config.configurationAt("xml"));
assertTrue("Wrong value of config-optional attribute",
decl.isOptional());
config.clearProperty("xml[@config-optional]");
config.setProperty("xml[@optional]", Boolean.TRUE);
decl = createDeclaration(config.configurationAt("xml"));
assertTrue("Old optional attribute not detected", decl.isOptional());
}