I wanted to skip two attributes from my acceptance test.So I added following part to remove that two attributes.This is given me a error: junit.framework.AssertionFailedError: org.custommonkey.xmlunit.Diff [different] Expected number of element attributes '2' but was '1'
Part of XML file:
<a:content schemaVS="1"
a:schemaLocate="http://www.ContentXML.xsd"
whiteSpaceMode="preserve">
<section type="Chapter" id="drd121">
<p type="H1">This is H1.</p>
</section>
Part of Java implementation:
public Document removeIgnoredCxmlNodes(Document resultDocument) {
Element contentElement=(Element) resultDocument.getElementsByTagName("a:content").item(0);
contentElement.removeAttribute("schemaVS");
contentElement.removeAttribute("a:schemaLocate");
return resultDocument;
}
public void cxmlShouldBeProduced(String location) throws Throwable {
try {
Document expectedDocument = parseDocument(RESOURCES_DIR_PATH.resolve(location));
Document resultDocument = removeIgnoredCxmlNodes(parseDocument(resultCxmlPath));
assertXMLEqual(expectedDocument, resultDocument);
} catch (NullPointerException e) {
e.printStackTrace();
}
}