当前位置: 首页>>代码示例>>Java>>正文


Java XMLUnit.setNormalize方法代码示例

本文整理汇总了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);
}
 
开发者ID:mojohaus,项目名称:jaxb2-maven-plugin,代码行数:25,代码来源:AbstractSourceCodeAwareNodeProcessingTest.java

示例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());
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:9,代码来源:DLNAServiceTest.java


注:本文中的org.custommonkey.xmlunit.XMLUnit.setNormalize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。