use of org.custommonkey.xmlunit.Diff in project jersey by jersey.
the class WadlBeanParamTest method testBeanParamConstructorInitializedBean.
private void testBeanParamConstructorInitializedBean(String resource) throws Exception {
final Response response = target("/application.wadl").request().get();
final Document d = WadlResourceTest.extractWadlAsDocument(response);
final XPath xp = XPathFactory.newInstance().newXPath();
final SimpleNamespaceResolver nsContext = new SimpleNamespaceResolver("wadl", "http://wadl.dev.java.net/2009/02");
xp.setNamespaceContext(nsContext);
final Diff diff = XMLUnit.compareXML(nodeAsString(xp.evaluate("//wadl:resource[@path='wadlBeanParamReference']/wadl:resource", d, XPathConstants.NODE)), nodeAsString(xp.evaluate("//wadl:resource[@path='" + resource + "']/wadl:resource", d, XPathConstants.NODE)));
XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(ImmutableMap.of("wadl", "http://wadl.dev.java.net/2009/02")));
diff.overrideElementQualifier(elementQualifier);
XMLAssert.assertXMLEqual(diff, true);
}
use of org.custommonkey.xmlunit.Diff in project cucumber-jvm by cucumber.
the class TestNGFormatterTest method assertXmlEqual.
private void assertXmlEqual(String expected, String actual) throws SAXException, IOException {
XMLUnit.setIgnoreWhitespace(true);
Diff diff = new Diff(expected, actual) {
@Override
public int differenceFound(Difference difference) {
if (difference.getControlNodeDetail().getNode().getNodeName().matches("started-at|finished-at")) {
return 0;
}
return super.differenceFound(difference);
}
};
assertTrue("XML files are similar " + diff + "\nFormatterOutput = " + actual, diff.identical());
}
use of org.custommonkey.xmlunit.Diff in project cucumber-jvm by cucumber.
the class JUnitFormatterTest method assertXmlEqual.
private void assertXmlEqual(String expected, String actual) throws SAXException, IOException {
XMLUnit.setIgnoreWhitespace(true);
Diff diff = new Diff(expected, actual);
assertTrue("XML files are similar " + diff + "\nFormatterOutput = " + actual, diff.identical());
}
use of org.custommonkey.xmlunit.Diff in project ORCID-Source by ORCID.
the class VisibilityFilterImplTest method testFilterStripWithVisibilities.
@Test
public void testFilterStripWithVisibilities() throws Exception {
protectedOrcidMessage = getOrcidMessage("/orcid-protected-full-message-latest.xml");
publicOrcidMessage = getOrcidMessage("/orcid-stripped-with-visibility-message-latest.xml");
OrcidMessage orcidMessage = visibilityFilter.filter(cascadeSectionPrivacyToItems(protectedOrcidMessage), Visibility.PUBLIC);
Diff myDiff = new Diff(publicOrcidMessage.toString(), orcidMessage.toString());
assertEquals(publicOrcidMessage.toString(), orcidMessage.toString());
assertTrue(myDiff.toString(), myDiff.similar());
}
use of org.custommonkey.xmlunit.Diff in project groovy by apache.
the class XmlAssert method assertXmlEquals.
public static void assertXmlEquals(String expected, String actual) throws Exception {
XMLUnit.setIgnoreWhitespace(true);
Diff diff = new Diff(expected, actual);
Assert.assertTrue(diff.toString(), diff.similar());
}
Aggregations