Class Comparison


  • public class Comparison
    extends java.lang.Object
    Details of a single comparison XMLUnit has performed.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Comparison.Detail
      The details of a target (usually some representation of an XML Node) that took part in the comparison.
    • Constructor Summary

      Constructors 
      Constructor Description
      Comparison​(ComparisonType t, org.w3c.dom.Node controlTarget, java.lang.String controlXPath, java.lang.Object controlValue, java.lang.String controlParentXPath, org.w3c.dom.Node testTarget, java.lang.String testXPath, java.lang.Object testValue, java.lang.String testParentXPath)
      Creates a new comparison.
      Comparison​(ComparisonType t, XPathContext controlContext, org.w3c.dom.Node controlTarget, java.lang.Object controlValue, XPathContext testContext, org.w3c.dom.Node testTarget, java.lang.Object testValue)
      Creates a new comparison.
    • Constructor Detail

      • Comparison

        public Comparison​(ComparisonType t,
                          org.w3c.dom.Node controlTarget,
                          java.lang.String controlXPath,
                          java.lang.Object controlValue,
                          java.lang.String controlParentXPath,
                          org.w3c.dom.Node testTarget,
                          java.lang.String testXPath,
                          java.lang.Object testValue,
                          java.lang.String testParentXPath)
        Creates a new comparison.
        Parameters:
        t - the type of comparison
        controlTarget - the control node the comparison applies to
        controlXPath - xpath of the control node the comparison applies to
        controlValue - value from the control node used during comparison
        controlParentXPath - xpath of the control node' parent
        testTarget - the test node the comparison applies to
        testXPath - xpath of the test node the comparison applies to
        testValue - value from the test node used during comparison
        testParentXPath - xpath of the test node' parent
      • Comparison

        public Comparison​(ComparisonType t,
                          XPathContext controlContext,
                          org.w3c.dom.Node controlTarget,
                          java.lang.Object controlValue,
                          XPathContext testContext,
                          org.w3c.dom.Node testTarget,
                          java.lang.Object testValue)
        Creates a new comparison.
        Parameters:
        t - the type of comparison
        controlContext - xpathContext object contains the current and parent XPath
        controlTarget - the control node the comparison applies to
        controlValue - value from the control node used during comparison
        testContext - xpathContext object contains the current and parent XPath
        testTarget - the test node the comparison applies to
        testValue - value from the test node used during comparison
        Since:
        XMLUnit 2.10.1
    • Method Detail

      • getType

        public ComparisonType getType()
        The kind of comparison performed.
        Returns:
        the type of comparison
      • getControlDetails

        public Comparison.Detail getControlDetails()
        Details of the control target.
        Returns:
        details of the control target
      • getTestDetails

        public Comparison.Detail getTestDetails()
        Details of the test target.
        Returns:
        details of the test target
      • toString

        public java.lang.String toString​(ComparisonFormatter formatter)
        Returns a string representation of this comparison using the given ComparisonFormatter
        Parameters:
        formatter - the ComparisonFormatter to use
        Returns:
        a string representation of this comparison
      • toString

        public java.lang.String toString()
        Returns a string representation of this comparison using DefaultComparisonFormatter
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this comparison