String input,
String expected)
throws Exception {
XMLReader reader = DOMUtilities.getReader();
Document dom = DOMUtilities.read(reader, input);
new StyleRenamerTreeVisitor().visit(dom.getRootElement());
StyleEmulationVisitor visitor = createStyleVisitor();
visitor.transform(dom);
String actual = DOMUtilities.toString(dom, encoder);
assertEquals("Transformed result should match: " +
"\nEXPECTED: " + expected +
"\nACTUAL : " + actual + "\n",
expected,
actual);
// Visit all the nodes and examine how many time each node has been
// processed.
VisitationCheckerDOMVisitor visitationChecker =
new VisitationCheckerDOMVisitor();
dom.forEachChild(visitationChecker);
// System.out.println((DOMUtilities.toString(dom.getContentRoot(),
// protocol)));
// TODO: we have had bugs where nodes were not visited, so fix this