當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。