@Test public void compareXPathOfDifferentRootElements() { DOMDifferenceEngine d = new DOMDifferenceEngine(); DiffExpecter ex = new DiffExpecter(ComparisonType.ELEMENT_TAG_NAME, "/x[1]", "/y[1]"); d.addDifferenceListener(ex); d.setComparisonController(ComparisonControllers.StopWhenDifferent); d.compare(new DOMSource(doc.createElement("x")), new DOMSource(doc.createElement("y"))); assertEquals(1, ex.invoked); }
@Override public void compare(Source control, Source test) { if (control == null) { throw new IllegalArgumentException("control must not be null"); } if (test == null) { throw new IllegalArgumentException("test must not be null"); } try { Node controlNode = Convert.toNode(control, documentBuilderFactory); Node testNode = Convert.toNode(test, documentBuilderFactory); compareNodes(controlNode, xpathContextFor(controlNode), testNode, xpathContextFor(testNode)); } catch (Exception ex) { throw new XMLUnitException("Caught exception during comparison", ex); } }
DOMDifferenceEngine extends AbstractDifferenceEngine { @Override public void compare(Source control, Source test) { if (control == null) { throw new IllegalArgumentException("control must not be null"); } if (test == null) { throw new IllegalArgumentException("test must not be null"); } try { Node controlNode = Convert.toNode(control, documentBuilderFactory); Node testNode = Convert.toNode(test, documentBuilderFactory); compareNodes(controlNode, xpathContextFor(controlNode), testNode, xpathContextFor(testNode)); } catch (Exception ex) { throw new XMLUnitException("Caught exception during comparison", ex); } } }
DOMDifferenceEngine extends AbstractDifferenceEngine { @Override public void compare(Source control, Source test) { if (control == null) { throw new IllegalArgumentException("control must not be null"); } if (test == null) { throw new IllegalArgumentException("test must not be null"); } try { Node controlNode = Convert.toNode(control, documentBuilderFactory); Node testNode = Convert.toNode(test, documentBuilderFactory); compareNodes(controlNode, xpathContextFor(controlNode), testNode, xpathContextFor(testNode)); } catch (Exception ex) { throw new XMLUnitException("Caught exception during comparison", ex); } } DOMDifferenceEngine();  DOMDifferenceEngine(final DocumentBuilderFactory f); }
DOMDifferenceEngine extends AbstractDifferenceEngine { @Override public void compare(Source control, Source test) { if (control == null) { throw new IllegalArgumentException("control must not be null"); } if (test == null) { throw new IllegalArgumentException("test must not be null"); } try { Node controlNode = Convert.toNode(control, documentBuilderFactory); Node testNode = Convert.toNode(test, documentBuilderFactory); compareNodes(controlNode, xpathContextFor(controlNode), testNode, xpathContextFor(testNode)); } catch (Exception ex) { throw new XMLUnitException("Caught exception during comparison", ex); } } DOMDifferenceEngine();  DOMDifferenceEngine(final DocumentBuilderFactory f); void setDocumentBuilderFactory(DocumentBuilderFactory f); @Override void compare(Source control, Source test); }
DOMDifferenceEngine extends AbstractDifferenceEngine { @Override public void compare(Source control, Source test) { if (control == null) { throw new IllegalArgumentException("control must not be null"); } if (test == null) { throw new IllegalArgumentException("test must not be null"); } try { Node controlNode = Convert.toNode(control, documentBuilderFactory); Node testNode = Convert.toNode(test, documentBuilderFactory); compareNodes(controlNode, xpathContextFor(controlNode), testNode, xpathContextFor(testNode)); } catch (Exception ex) { throw new XMLUnitException("Caught exception during comparison", ex); } } DOMDifferenceEngine();  DOMDifferenceEngine(final DocumentBuilderFactory f); void setDocumentBuilderFactory(DocumentBuilderFactory f); @Override void compare(Source control, Source test);  }