Package org.xmlunit.diff
Class Diff
- java.lang.Object
-
- org.xmlunit.diff.Diff
-
public class Diff extends java.lang.Object
The Diff-Object is the result of two comparisons.- See Also:
DiffBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private javax.xml.transform.Source
controlSource
private static ComparisonFormatter
DEFAULT_FORMATTER
private java.lang.Iterable<Difference>
differences
private ComparisonFormatter
formatter
private javax.xml.transform.Source
testSource
-
Constructor Summary
Constructors Constructor Description Diff(javax.xml.transform.Source controlSource, javax.xml.transform.Source testSource, java.lang.Iterable<Difference> differences)
Encapsulates the compared sources and the differences found.Diff(javax.xml.transform.Source controlSource, javax.xml.transform.Source testSource, ComparisonFormatter formatter, java.lang.Iterable<Difference> differences)
Encapsulates the compared sources and the differences found.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
fullDescription()
Returns a string representation of this diff using internalComparisonFormatter
orDefaultComparisonFormatter
if formatter wasn't set.java.lang.String
fullDescription(ComparisonFormatter formatter)
Returns a string representation of this diff using the givenComparisonFormatter
javax.xml.transform.Source
getControlSource()
java.lang.Iterable<Difference>
getDifferences()
javax.xml.transform.Source
getTestSource()
boolean
hasDifferences()
java.lang.String
toString()
Returns a string representation of first found difference in this diff using internalComparisonFormatter
orDefaultComparisonFormatter
if formatter wasn't setjava.lang.String
toString(ComparisonFormatter formatter)
Returns a string representation of first found difference in this diff using the givenComparisonFormatter
-
-
-
Field Detail
-
DEFAULT_FORMATTER
private static final ComparisonFormatter DEFAULT_FORMATTER
-
differences
private final java.lang.Iterable<Difference> differences
-
controlSource
private final javax.xml.transform.Source controlSource
-
testSource
private final javax.xml.transform.Source testSource
-
formatter
private final ComparisonFormatter formatter
-
-
Constructor Detail
-
Diff
public Diff(javax.xml.transform.Source controlSource, javax.xml.transform.Source testSource, java.lang.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(javax.xml.transform.Source controlSource, javax.xml.transform.Source testSource, ComparisonFormatter formatter, java.lang.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 java.lang.String fullDescription()
Returns a string representation of this diff using internalComparisonFormatter
orDefaultComparisonFormatter
if 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 java.lang.String fullDescription(ComparisonFormatter formatter)
Returns a string representation of this diff using the givenComparisonFormatter
Each comparison result separated by the end of the line.
- Parameters:
formatter
- theComparisonFormatter
to 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 java.lang.Iterable<Difference> getDifferences()
- Returns:
- all differences found before the comparison process stopped.
-
getControlSource
public javax.xml.transform.Source getControlSource()
- Returns:
- the control XML source
-
getTestSource
public javax.xml.transform.Source getTestSource()
- Returns:
- the test XML source
-
toString
public java.lang.String toString()
Returns a string representation of first found difference in this diff using internalComparisonFormatter
orDefaultComparisonFormatter
if formatter wasn't set- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of first found difference in this diff
- See Also:
fullDescription()
-
toString
public java.lang.String toString(ComparisonFormatter formatter)
Returns a string representation of first found difference in this diff using the givenComparisonFormatter
- Parameters:
formatter
- theComparisonFormatter
to use- Returns:
- a string representation of first found difference in this diff
- See Also:
fullDescription(ComparisonFormatter)
-
-