我必须尝试它的工作
package WebInitalizar;
import java.util.List;
import org.custommonkey.xmlunit.DetailedDiff;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Assert;
public class TestXml {
public static void main(String[] args) throws Exception {
String result = "10";
// will be ok
assertXMLEquals("1010", result);
}
public static void assertXMLEquals(String expectedXML, String actualXML) throws Exception {
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expectedXML, actualXML));
List> allDifferences = diff.getAllDifferences();
System.out.println(allDifferences);
Assert.assertEquals("Differences found: "+ diff.toString(), 0, allDifferences.size());
}
}