本文整理汇总了Java中org.custommonkey.xmlunit.XMLUnit.setNormalize方法的典型用法代码示例。如果您正苦于以下问题:Java XMLUnit.setNormalize方法的具体用法?Java XMLUnit.setNormalize怎么用?Java XMLUnit.setNormalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.custommonkey.xmlunit.XMLUnit
的用法示例。
在下文中一共展示了XMLUnit.setNormalize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareXmlIgnoringWhitespace
import org.custommonkey.xmlunit.XMLUnit; //导入方法依赖的package包/类
/**
* Compares XML documents provided by the two Readers.
*
* @param expected The expected document data.
* @param actual The actual document data.
* @return A DetailedDiff object, describing all differences in documents supplied.
* @throws org.xml.sax.SAXException If a SAXException was raised during parsing of the two Documents.
* @throws IOException If an I/O-related exception was raised while acquiring the data from the Readers.
*/
protected static Diff compareXmlIgnoringWhitespace(final String expected, final String actual) throws SAXException,
IOException {
// Check sanity
org.apache.commons.lang3.Validate.notNull(expected, "Cannot handle null expected argument.");
org.apache.commons.lang3.Validate.notNull(actual, "Cannot handle null actual argument.");
// Ignore whitespace - and also normalize the Documents.
XMLUnit.setNormalize(true);
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setNormalize(true);
// Compare and return
return XMLUnit.compareXML(expected, actual);
}
示例2: assertXMLEquals
import org.custommonkey.xmlunit.XMLUnit; //导入方法依赖的package包/类
private void assertXMLEquals(String expectedXML, String actualXML) throws SAXException, IOException {
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
XMLUnit.setNormalize(true);
DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expectedXML, actualXML));
List<?> allDifferences = diff.getAllDifferences();
Assert.assertEquals("XML differences found: " + diff.toString(), 0, allDifferences.size());
}