Element templateDef = parseTemplate(templateMarkup);
Element tagInstance = parseTemplate(tagMarkup);
templateDef.getOwnerDocument().adoptNode(tagInstance);
TagHandler tagHandler = new TemplateBasedTagHandler(tagInstance, TEST_NS, tagName);
TagRegistry reg = new DefaultTagRegistry(
ImmutableSet.of(tagHandler, new RepeatTagHandler()));
DocumentFragment result = processor.processTemplate(templateDef, context, resolver, reg);
String output = serialize(result);
assertEquals(expectedResult, output);