try {
TemplateTokenizer tokenizer = new TemplateTokenizer(ParserTest.class.getResourceAsStream("basic.html"));
TemplateParser parser = new TemplateParser(tokenizer);
Map<String, Object> p = new DefaultTemplateBindings();
p.put("class", "test");
TemplateDocument t = parser.parse();
assertNotNull(t);
Attribute a = t.locateTag("/div").getAttribute("class");
assertTrue(a instanceof ComplexAttribute);
ComplexAttribute c = (ComplexAttribute) a;
assertEquals(1, c.getFragments().size());
assertTrue(c.getFragments().get(0) instanceof ExpressionNode);
ExpressionNode node = (ExpressionNode) c.getFragments().get(0);
assertEquals("${class}", node.getSource());
StringWriter builder = new StringWriter();
FragmentList fragmentList = t.normalize();
assertEquals(3, fragmentList.size());
assertTrue(fragmentList.get(0) instanceof StaticFragment);
assertTrue(fragmentList.get(1) instanceof ExpressionNode);