attr.setName("attr1");
attr.setValue("US Value");
def.addAttribute(attr);
localDefs.put(def.getName(), def);
Definitions definitions = new DefinitionsImpl();
try {
definitions.addDefinitions(defs);
definitions.addDefinitions(localDefs, Locale.US);
} catch (NoSuchDefinitionException e) {
fail("Test failure: " + e);
}
assertNotNull("Couldn't get parent.",
definitions.getDefinition("parent.def1"));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("parent.def1").getTemplate());
assertEquals("Incorrect attr1 value", "value1",
definitions.getDefinition("parent.def1").getAttribute("attr1"));
assertNotNull("Couldn't get child.",
definitions.getDefinition("child.def1"));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("child.def1").getTemplate());
assertEquals("Incorrect attr1 value", "New value",
definitions.getDefinition("child.def1").getAttribute("attr1"));
assertNotNull("Couldn't get parent.",
definitions.getDefinition("parent.def1", Locale.US));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("parent.def1", Locale.US).getTemplate());
assertEquals("Incorrect attr1 value", "value1",
definitions.getDefinition("parent.def1", Locale.US).getAttribute("attr1"));
assertNotNull("Couldn't get child.",
definitions.getDefinition("child.def1", Locale.US));
assertEquals("Incorrect template value." , "/test1.jsp",
definitions.getDefinition("child.def1", Locale.US).getTemplate());
assertEquals("Incorrect attr1 value", "US Value",
definitions.getDefinition("child.def1", Locale.US).getAttribute("attr1"));
}