Codota Logo
DifferenceEngine.compare
Code IndexAdd Codota to your IDE (free)

How to use
compare
method
in
org.custommonkey.xmlunit.DifferenceEngine

Best Java code snippets using org.custommonkey.xmlunit.DifferenceEngine.compare (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: org.xmlunit/xmlunit-legacy

/**
 * If the expected and actual values are unequal then inform the listener of
 *  a difference and throw a DifferenceFoundException.
 * @param expected
 * @param actual
 * @param control
 * @param test
 * @param listener
 * @param difference
 * @throws DifferenceFoundException
 */
protected void compare(Object expected, Object actual,
            Node control, Node test, DifferenceListener listener, Difference difference)
  throws DifferenceFoundException {
  compare(expected, actual, control, test, listener, difference,
      controlTracker, testTracker);
}
origin: org.xmlunit/xmlunit-legacy

/**
 * Compare 2 elements and their attributes
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareElement(Element control, Element test,
               DifferenceListener listener) throws DifferenceFoundException {
  compare(getUnNamespacedNodeName(control), getUnNamespacedNodeName(test), 
      control, test, listener, ELEMENT_TAG_NAME);
  NamedNodeMap controlAttr = control.getAttributes();
  Integer controlNonXmlnsAttrLength =
    getNonSpecialAttrLength(controlAttr);
  NamedNodeMap testAttr = test.getAttributes();
  Integer testNonXmlnsAttrLength = getNonSpecialAttrLength(testAttr);
  compare(controlNonXmlnsAttrLength, testNonXmlnsAttrLength,
      control, test, listener, ELEMENT_NUM_ATTRIBUTES);
  compareElementAttributes(control, test, controlAttr, testAttr,
               listener);
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * Compare two Documents for doctype and then element differences
 * @param control
 * @param test
 * @param listener
 * @param elementQualifier
 * @throws DifferenceFoundException
 */
protected void compareDocument(Document control, Document test, 
                DifferenceListener listener, ElementQualifier elementQualifier) 
  throws DifferenceFoundException {
  DocumentType controlDoctype = control.getDoctype();
  DocumentType testDoctype = test.getDoctype();
  compare(getNullOrNotNull(controlDoctype), 
      getNullOrNotNull(testDoctype), 
      controlDoctype, testDoctype, listener, 
      HAS_DOCTYPE_DECLARATION);
  if (controlDoctype!=null && testDoctype!=null) {
    compareNode(controlDoctype, testDoctype, listener, elementQualifier);
  }
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * If the expected and actual values are unequal then inform the listener of
 *  a difference and throw a DifferenceFoundException.
 * @param expected
 * @param actual
 * @param control
 * @param test
 * @param listener
 * @param differenceType
 * @throws DifferenceFoundException
 */
protected void compare(Object expected, Object actual,
            Node control, Node test, DifferenceListener listener, Difference difference)
  throws DifferenceFoundException {
  compare(expected, actual, control, test, listener, difference,
      controlTracker, testTracker);
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * Compare 2 elements and their attributes
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareElement(Element control, Element test,
               DifferenceListener listener) throws DifferenceFoundException {
  compare(getUnNamespacedNodeName(control), getUnNamespacedNodeName(test), 
      control, test, listener, ELEMENT_TAG_NAME);
  NamedNodeMap controlAttr = control.getAttributes();
  Integer controlNonXmlnsAttrLength =
    getNonSpecialAttrLength(controlAttr);
  NamedNodeMap testAttr = test.getAttributes();
  Integer testNonXmlnsAttrLength = getNonSpecialAttrLength(testAttr);
  compare(controlNonXmlnsAttrLength, testNonXmlnsAttrLength,
      control, test, listener, ELEMENT_NUM_ATTRIBUTES);
  compareElementAttributes(control, test, controlAttr, testAttr,
               listener);
}
origin: org.xmlunit/xmlunit-legacy

/**
 * Compare two Documents for doctype and then element differences
 * @param control
 * @param test
 * @param listener
 * @param elementQualifier
 * @throws DifferenceFoundException
 */
protected void compareDocument(Document control, Document test, 
                DifferenceListener listener, ElementQualifier elementQualifier) 
  throws DifferenceFoundException {
  DocumentType controlDoctype = control.getDoctype();
  DocumentType testDoctype = test.getDoctype();
  compare(getNullOrNotNull(controlDoctype), 
      getNullOrNotNull(testDoctype), 
      controlDoctype, testDoctype, listener, 
      HAS_DOCTYPE_DECLARATION);
  if (controlDoctype!=null && testDoctype!=null) {
    compareNode(controlDoctype, testDoctype, listener, elementQualifier);
  }
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * Top of the recursive comparison execution tree
 */
protected final void compare() {
  if (compared) {
    return;
  }
  getDifferenceEngine().compare(controlDoc, testDoc, this,
                 elementQualifierDelegate);
  compared = true;
}
origin: org.xmlunit/xmlunit-legacy

/**
 * Compare two DocumentType nodes
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareDocumentType(DocumentType control, DocumentType test,
                  DifferenceListener listener) throws DifferenceFoundException {
  compare(control.getName(), test.getName(), control, test, listener,
      DOCTYPE_NAME);
  compare(control.getPublicId(), test.getPublicId(), control, test, listener,
      DOCTYPE_PUBLIC_ID);
  compare(control.getSystemId(), test.getSystemId(),
      control, test, listener, DOCTYPE_SYSTEM_ID);
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * Compare two DocumentType nodes
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareDocumentType(DocumentType control, DocumentType test,
                  DifferenceListener listener) throws DifferenceFoundException {
  compare(control.getName(), test.getName(), control, test, listener,
      DOCTYPE_NAME);
  compare(control.getPublicId(), test.getPublicId(), control, test, listener,
      DOCTYPE_PUBLIC_ID);
  compare(control.getSystemId(), test.getSystemId(),
      control, test, listener, DOCTYPE_SYSTEM_ID);
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

private void missingNode(Node control, Node test,
             DifferenceListener listener)
  throws DifferenceFoundException {
  if (control != null) {
    controlTracker.visited(control);
    compare(control.getNodeName(), null, control, null,
        listener, CHILD_NODE_NOT_FOUND, controlTracker, null);
  } else {
    testTracker.visited(test);
    compare(null, test.getNodeName(), null, test, listener,
        CHILD_NODE_NOT_FOUND, null, testTracker);
  }
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * Compare two attributes
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareAttribute(Attr control, Attr test,
                DifferenceListener listener) throws DifferenceFoundException {
  controlTracker.visited(control);
  testTracker.visited(test);
  
  compare(control.getPrefix(), test.getPrefix(), control, test, 
      listener, NAMESPACE_PREFIX);
      
  compare(control.getValue(), test.getValue(), control, test,
      listener, ATTR_VALUE);
  compare(control.getSpecified() ? Boolean.TRUE : Boolean.FALSE,
      test.getSpecified() ? Boolean.TRUE : Boolean.FALSE,
      control, test, listener, ATTR_VALUE_EXPLICITLY_SPECIFIED);
}
origin: org.xmlunit/xmlunit-legacy

/**
 * Compare two attributes
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareAttribute(Attr control, Attr test,
                DifferenceListener listener) throws DifferenceFoundException {
  controlTracker.visited(control);
  testTracker.visited(test);
  
  compare(control.getPrefix(), test.getPrefix(), control, test, 
      listener, NAMESPACE_PREFIX);
      
  compare(control.getValue(), test.getValue(), control, test,
      listener, ATTR_VALUE);
  compare(control.getSpecified() ? Boolean.TRUE : Boolean.FALSE,
      test.getSpecified() ? Boolean.TRUE : Boolean.FALSE,
      control, test, listener, ATTR_VALUE_EXPLICITLY_SPECIFIED);
}
origin: org.xmlunit/xmlunit-legacy

private void missingNode(Node control, Node test,
             DifferenceListener listener)
  throws DifferenceFoundException {
  if (control != null) {
    controlTracker.visited(control);
    compare(getQName(control), null, control, null,
        listener, CHILD_NODE_NOT_FOUND, controlTracker, null);
  } else {
    testTracker.visited(test);
    compare(null, getQName(test), null, test, listener,
        CHILD_NODE_NOT_FOUND, null, testTracker);
  }
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * Character comparison method used by comments, text and CDATA sections
 * @param control
 * @param test
 * @param listener
 * @param differenceType
 * @throws DifferenceFoundException
 */
private void compareCharacterData(CharacterData control, CharacterData test,
                 DifferenceListener listener, Difference difference)
  throws DifferenceFoundException {
  compare(control.getData(), test.getData(), control, test, listener,
      difference);
}
origin: org.xmlunit/xmlunit-legacy

/**
 * Character comparison method used by comments, text and CDATA sections
 * @param control
 * @param test
 * @param listener
 * @param difference
 * @throws DifferenceFoundException
 */
private void compareCharacterData(CharacterData control, CharacterData test,
                 DifferenceListener listener, Difference difference)
  throws DifferenceFoundException {
  compare(control.getData(), test.getData(), control, test, listener,
      difference);
}
origin: org.xmlunit/xmlunit-legacy

/**
 * Compare two processing instructions
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareProcessingInstruction(ProcessingInstruction control,
                      ProcessingInstruction test, DifferenceListener listener)
  throws DifferenceFoundException {
  compare(control.getTarget(), test.getTarget(), control, test, listener,
      PROCESSING_INSTRUCTION_TARGET);
  compare(control.getData(), test.getData(), control, test, listener,
      PROCESSING_INSTRUCTION_DATA);
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * Compare the number of children, and if the same, compare the actual
 *  children via their NodeLists.
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareHasChildNodes(Node control, Node test,
                  DifferenceListener listener) throws DifferenceFoundException {
  Boolean controlHasChildren = hasChildNodes(control);
  Boolean testHasChildren = hasChildNodes(test);
  compare(controlHasChildren, testHasChildren, control, test,
      listener, HAS_CHILD_NODES);
}
origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * Compare two processing instructions
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareProcessingInstruction(ProcessingInstruction control,
                      ProcessingInstruction test, DifferenceListener listener)
  throws DifferenceFoundException {
  compare(control.getTarget(), test.getTarget(), control, test, listener,
      PROCESSING_INSTRUCTION_TARGET);
  compare(control.getData(), test.getData(), control, test, listener,
      PROCESSING_INSTRUCTION_DATA);
}
origin: org.xmlunit/xmlunit-legacy

/**
 * Compare the number of children, and if the same, compare the actual
 *  children via their NodeLists.
 * @param control
 * @param test
 * @param listener
 * @throws DifferenceFoundException
 */
protected void compareHasChildNodes(Node control, Node test,
                  DifferenceListener listener) throws DifferenceFoundException {
  Boolean controlHasChildren = hasChildNodes(control);
  Boolean testHasChildren = hasChildNodes(test);
  compare(controlHasChildren, testHasChildren, control, test,
      listener, HAS_CHILD_NODES);
}
origin: org.jboss.windup/windup-engine

  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;
  }
}
org.custommonkey.xmlunitDifferenceEnginecompare

Javadoc

If the expected and actual values are unequal then inform the listener of a difference and throw a DifferenceFoundException.

Popular methods of DifferenceEngine

  • <init>
    Simple constructor
  • compareAttribute
    Compare two attributes
  • compareCharacterData
    Character comparison method used by comments, text and CDATA sections
  • compareComment
    Compare two comments
  • compareDocument
    Compare two Documents for doctype and then element differences
  • compareDocumentType
    Compare two DocumentType nodes
  • compareElement
    Compare 2 elements and their attributes
  • compareElementAttributes
  • compareHasChildNodes
    Compare the number of children, and if the same, compare the actual children via their NodeLists.
  • compareNode
    First point of call: if nodes are comparable it compares node values then recurses to compare node c
  • compareNodeBasics
    Compares node type and node namespace characteristics: basically determines if nodes are comparable
  • compareNodeChildren
    Compare the number of children, and if the same, compare the actual children via their NodeLists.
  • compareNodeBasics,
  • compareNodeChildren,
  • compareNodeList,
  • compareProcessingInstruction,
  • compareRecognizedXMLSchemaInstanceAttribute,
  • compareText,
  • comparingTextAndCDATA,
  • getNonSpecialAttrLength,
  • getNullOrNotNull

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • addToBackStack (FragmentTransaction)
  • orElseThrow (Optional)
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • JTable (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now