/** * Lazily initializes the difference engine if it hasn't been set * via a constructor. */ private DifferenceEngine getDifferenceEngine() { return differenceEngine == null ? new DifferenceEngine(this, matchTrackerDelegate) : differenceEngine; }
/** * Lazily initializes the difference engine if it hasn't been set * via a constructor. */ private DifferenceEngineContract getDifferenceEngine() { if (differenceEngine == null) { if ( XMLUnit.getIgnoreAttributeOrder() && (!usesUnknownElementQualifier() || XMLUnit.getCompareUnmatched()) ) { return new NewDifferenceEngine(this, matchTrackerDelegate); } return new DifferenceEngine(this, matchTrackerDelegate); } return differenceEngine; }
private boolean isdifferent(Document testDoc, Document controlDoc) { boolean isdifferent = false; XMLUnit.setIgnoreWhitespace(true); XMLUnit.setIgnoreComments(true); XMLUnit.setNormalize(true); Diff myDiff = new Diff(controlDoc, testDoc); DetailedDiff myComparisonController = new DetailedDiff(myDiff); DifferenceEngine engine = new DifferenceEngine(myComparisonController); XmlDifferenceListener listener = new XmlDifferenceListener(); ElementNameAndAttributeQualifier myElementQualifier = new ElementNameAndAttributeQualifier(); try { //debug engine.compare(controlDoc.getDocumentElement(), testDoc.getDocumentElement(), listener, myElementQualifier); } catch (NullPointerException ne) { LOG.error(ne); } isdifferent =listener.called(); return isdifferent; } }