Package org.custommonkey.xmlunit
Class Difference
- java.lang.Object
-
- org.custommonkey.xmlunit.Difference
-
public class Difference extends java.lang.ObjectValue object that describes a difference between DOM Nodes using one of the DifferenceConstants ID values and a NodeDetail instance.- See Also:
NodeDetail
-
-
Field Summary
Fields Modifier and Type Field Description private NodeDetailcontrolNodeDetailprivate java.lang.StringdescriptionDescription of the differenceprivate intidSimple unique identifierprivate booleanrecoverableTRUE if the difference represents a similarity, FALSE otherwiseprivate NodeDetailtestNodeDetail
-
Constructor Summary
Constructors Modifier Constructor Description protectedDifference(int id, java.lang.String description)Constructor for non-similar Difference instancesprotectedDifference(int id, java.lang.String description, boolean recoverable)Constructor for similar Difference instancesprotectedDifference(Difference prototype, NodeDetail controlNodeDetail, NodeDetail testNodeDetail)Copy constructor using prototype Difference and encountered NodeDetails
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidappendBasicRepresentation(java.lang.StringBuffer buf)private voidappendDetailedRepresentation(java.lang.StringBuffer buf)booleanequals(java.lang.Object other)Now that Differences can be constructed from prototypes we need to be able to compare them to those in DifferenceConstantsNodeDetailgetControlNodeDetail()java.lang.StringgetDescription()intgetId()NodeDetailgetTestNodeDetail()inthashCode()hashcode implementation to go with equals.booleanisRecoverable()protected voidsetRecoverable(boolean overrideValue)Allow the recoverable field value to be overridden.java.lang.StringtoString()
-
-
-
Field Detail
-
id
private final int id
Simple unique identifier
-
description
private final java.lang.String description
Description of the difference
-
recoverable
private boolean recoverable
TRUE if the difference represents a similarity, FALSE otherwise
-
controlNodeDetail
private NodeDetail controlNodeDetail
-
testNodeDetail
private NodeDetail testNodeDetail
-
-
Constructor Detail
-
Difference
protected Difference(int id, java.lang.String description)Constructor for non-similar Difference instances- Parameters:
id-description-
-
Difference
protected Difference(int id, java.lang.String description, boolean recoverable)Constructor for similar Difference instances- Parameters:
id-description-
-
Difference
protected Difference(Difference prototype, NodeDetail controlNodeDetail, NodeDetail testNodeDetail)
Copy constructor using prototype Difference and encountered NodeDetails
-
-
Method Detail
-
getId
public int getId()
- Returns:
- the id
-
getDescription
public java.lang.String getDescription()
- Returns:
- the description
-
isRecoverable
public boolean isRecoverable()
- Returns:
- TRUE if the difference represents a similarity, FALSE otherwise
-
setRecoverable
protected void setRecoverable(boolean overrideValue)
Allow the recoverable field value to be overridden. Used when an override DifferenceListener is used in conjunction with a DetailedDiff.
-
getControlNodeDetail
public NodeDetail getControlNodeDetail()
- Returns:
- the NodeDetail from the piece of XML used as the control at the Node where this difference was encountered
-
getTestNodeDetail
public NodeDetail getTestNodeDetail()
- Returns:
- the NodeDetail from the piece of XML used as the test at the Node where this difference was encountered
-
equals
public boolean equals(java.lang.Object other)
Now that Differences can be constructed from prototypes we need to be able to compare them to those in DifferenceConstants- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
hashcode implementation to go with equals.- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- a basic representation of the object state and identity
and if
NodeDetailinstances are populated append their details also
-
appendBasicRepresentation
private void appendBasicRepresentation(java.lang.StringBuffer buf)
-
appendDetailedRepresentation
private void appendDetailedRepresentation(java.lang.StringBuffer buf)
-
-