<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.8.2</version>
</dependency>
String controlXML = "<root><message>Hello World!</message></root>";
String testXML = "<root><message>Hello XMLUnit!</message></root>";
Diff xmlDiff = DiffBuilder.compare(controlXML).withTest(testXML).build();
assertXMLEqual("XML documents are similar", controlXML, testXML);