// Compare the expected and actual outputs.
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreComments(true);
XMLUnit.setIgnoreAttributeOrder(true);
Diff diff = new Diff(expectedXml, writer.toString());
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
assertTrue("The output XML was different to the expected XML: "
+ diff.toString(), diff.similar());
}
}