@Test public void compareAttributes() { Attr a1 = doc.createAttribute("foo"); Attr a2 = doc.createAttribute("foo"); DOMDifferenceEngine d = new DOMDifferenceEngine(); DiffExpecter ex = new DiffExpecter(ComparisonType.ATTR_VALUE_EXPLICITLY_SPECIFIED); ex = new DiffExpecter(ComparisonType.ATTR_VALUE); d.addDifferenceListener(ex); d.setComparisonController(ComparisonControllers.StopWhenDifferent); Attr a3 = doc.createAttribute("foo"); a1.setValue("foo"); a2.setValue("foo"); a3.setValue("bar"); assertEquals(wrap(ComparisonResult.EQUAL), d.compareNodes(a1, new XPathContext(), a2, new XPathContext())); assertEquals(wrapAndStop(ComparisonResult.DIFFERENT), d.compareNodes(a1, new XPathContext(), a3, new XPathContext())); assertEquals(1, ex.invoked); }
private ComparisonState compareAttributes(Attr control, XPathContext controlContext, Attr test, XPathContext testContext) { return compareAttributeExplicitness(control, controlContext, test, testContext).apply() .andThen(new Comparison(ComparisonType.ATTR_VALUE, control, getXPath(controlContext), control.getValue(), getParentXPath(controlContext), test, getXPath(testContext), test.getValue(), getParentXPath(testContext))); }
DOMDifferenceEngine extends AbstractDifferenceEngine { private ComparisonState compareAttributes(Attr control, XPathContext controlContext, Attr test, XPathContext testContext) { return compareAttributeExplicitness(control, controlContext, test, testContext).apply() .andThen(new Comparison(ComparisonType.ATTR_VALUE, control, getXPath(controlContext), control.getValue(), getParentXPath(controlContext), test, getXPath(testContext), test.getValue(), getParentXPath(testContext))); } }
DOMDifferenceEngine extends AbstractDifferenceEngine { private ComparisonState compareAttributes(Attr control, XPathContext controlContext, Attr test, XPathContext testContext) { return compareAttributeExplicitness(control, controlContext, test, testContext).apply() .andThen(new Comparison(ComparisonType.ATTR_VALUE, control, getXPath(controlContext), control.getValue(), getParentXPath(controlContext), test, getXPath(testContext), test.getValue(), getParentXPath(testContext))); } DOMDifferenceEngine();  DOMDifferenceEngine(final DocumentBuilderFactory f); }
DOMDifferenceEngine extends AbstractDifferenceEngine { private ComparisonState compareAttributes(Attr control, XPathContext controlContext, Attr test, XPathContext testContext) { return compareAttributeExplicitness(control, controlContext, test, testContext).apply() .andThen(new Comparison(ComparisonType.ATTR_VALUE, control, getXPath(controlContext), control.getValue(), getParentXPath(controlContext), test, getXPath(testContext), test.getValue(), getParentXPath(testContext))); } DOMDifferenceEngine();  DOMDifferenceEngine(final DocumentBuilderFactory f); void setDocumentBuilderFactory(DocumentBuilderFactory f); @Override void compare(Source control, Source test); }
DOMDifferenceEngine extends AbstractDifferenceEngine { private ComparisonState compareAttributes(Attr control, XPathContext controlContext, Attr test, XPathContext testContext) { return compareAttributeExplicitness(control, controlContext, test, testContext).apply() .andThen(new Comparison(ComparisonType.ATTR_VALUE, control, getXPath(controlContext), control.getValue(), getParentXPath(controlContext), test, getXPath(testContext), test.getValue(), getParentXPath(testContext))); } DOMDifferenceEngine();  DOMDifferenceEngine(final DocumentBuilderFactory f); void setDocumentBuilderFactory(DocumentBuilderFactory f); @Override void compare(Source control, Source test);  }