Package org.xmlunit.diff
Class Diff
- java.lang.Object
-
- org.xmlunit.diff.Diff
-
public class Diff extends Object
The Diff-Object is the result of two comparisons.- See Also:
DiffBuilder
-
-
Constructor Summary
Constructors Constructor Description Diff(Source controlSource, Source testSource, Iterable<Difference> differences)Encapsulates the compared sources and the differences found.Diff(Source controlSource, Source testSource, ComparisonFormatter formatter, Iterable<Difference> differences)Encapsulates the compared sources and the differences found.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringfullDescription()Returns a string representation of this diff using internalComparisonFormatterorDefaultComparisonFormatterif formatter wasn't set.StringfullDescription(ComparisonFormatter formatter)Returns a string representation of this diff using the givenComparisonFormatterSourcegetControlSource()Iterable<Difference>getDifferences()SourcegetTestSource()booleanhasDifferences()StringtoString()Returns a string representation of first found difference in this diff using internalComparisonFormatterorDefaultComparisonFormatterif formatter wasn't setStringtoString(ComparisonFormatter formatter)Returns a string representation of first found difference in this diff using the givenComparisonFormatter
-
-
-
Constructor Detail
-
Diff
public Diff(Source controlSource, Source testSource, Iterable<Difference> differences)
Encapsulates the compared sources and the differences found.- Parameters:
controlSource- the control XML sourcetestSource- the test XML sourcedifferences- the differences found
-
Diff
public Diff(Source controlSource, Source testSource, ComparisonFormatter formatter, Iterable<Difference> differences)
Encapsulates the compared sources and the differences found.- Parameters:
controlSource- the control XML sourcetestSource- the test XML sourcedifferences- the differences foundformatter- formatter to use when displaying the differences
-
-
Method Detail
-
fullDescription
public String fullDescription()
Returns a string representation of this diff using internalComparisonFormatterorDefaultComparisonFormatterif formatter wasn't set.Each comparison result separated by the end of the line.
- Returns:
- a string representation of this diff
- Since:
- 2.8.3
-
fullDescription
public String fullDescription(ComparisonFormatter formatter)
Returns a string representation of this diff using the givenComparisonFormatterEach comparison result separated by the end of the line.
- Parameters:
formatter- theComparisonFormatterto use- Returns:
- a string representation of this diff
- Since:
- 2.8.3
-
hasDifferences
public boolean hasDifferences()
- Returns:
- true if there was at least one difference.
-
getDifferences
public Iterable<Difference> getDifferences()
- Returns:
- all differences found before the comparison process stopped.
-
getControlSource
public Source getControlSource()
- Returns:
- the control XML source
-
getTestSource
public Source getTestSource()
- Returns:
- the test XML source
-
toString
public String toString()
Returns a string representation of first found difference in this diff using internalComparisonFormatterorDefaultComparisonFormatterif formatter wasn't set- Overrides:
toStringin classObject- Returns:
- a string representation of first found difference in this diff
- See Also:
fullDescription()
-
toString
public String toString(ComparisonFormatter formatter)
Returns a string representation of first found difference in this diff using the givenComparisonFormatter- Parameters:
formatter- theComparisonFormatterto use- Returns:
- a string representation of first found difference in this diff
- See Also:
fullDescription(ComparisonFormatter)
-
-