@Test
public void testReplacePlaceholders() {

    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    attributes.put("attrib1", new Attribute("value{2}"));
    attributes.put("attrib2", new Attribute("value{2}{3}"));
    attributes.put("attrib3", new Attribute(null, Expression
            .createExpression("expr{1}", "EL"), null, null));
    Definition definition = new Definition("definitionName", new Attribute(
            "template{1}"), attributes);
    definition.setExtends("{2}ext");
    definition.setPreparer("{3}prep");
    Definition nudef = PatternUtil.replacePlaceholders(definition, "nudef",
            "value0", "value1", "value2", "value3");
    assertEquals("nudef", nudef.getName());
    assertEquals("value2ext", nudef.getExtends());
    assertEquals("value3prep", nudef.getPreparer());
    Attribute attribute = nudef.getTemplateAttribute();
    assertEquals("templatevalue1", attribute.getValue());
    attribute = nudef.getAttribute("attrib1");
    assertEquals("valuevalue2", attribute.getValue());
    attribute = nudef.getAttribute("attrib2");
    assertEquals("valuevalue2value3", attribute.getValue());
    attribute = nudef.getAttribute("attrib3");
    assertEquals("exprvalue1", attribute.getExpressionObject().getExpression());
}