org.custommonkey.xmlunit

Class Difference

public class Difference extends Object

Value object that describes a difference between DOM Nodes using one of the DifferenceConstants ID values and a NodeDetail instance.
Examples and more at xmlunit.sourceforge.net

See Also: NodeDetail

Constructor Summary
protected Difference(int id, String description)
Constructor for non-similar Difference instances
protected Difference(int id, String description, boolean recoverable)
Constructor for similar Difference instances
protected Difference(Difference prototype, NodeDetail controlNodeDetail, NodeDetail testNodeDetail)
Copy constructor using prototype Difference and encountered NodeDetails
Method Summary
booleanequals(Object other)
Now that Differences can be constructed from prototypes we need to be able to compare them to those in DifferenceConstants
NodeDetailgetControlNodeDetail()
StringgetDescription()
intgetId()
NodeDetailgetTestNodeDetail()
booleanisRecoverable()
protected voidsetRecoverable(boolean overrideValue)
Allow the recoverable field value to be overridden.
StringtoString()

Constructor Detail

Difference

protected Difference(int id, String description)
Constructor for non-similar Difference instances

Parameters: id description

Difference

protected Difference(int id, 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

equals

public boolean equals(Object other)
Now that Differences can be constructed from prototypes we need to be able to compare them to those in DifferenceConstants

getControlNodeDetail

public NodeDetail getControlNodeDetail()

Returns: the NodeDetail from the piece of XML used as the control at the Node where this difference was encountered

getDescription

public String getDescription()

Returns: the description

getId

public int getId()

Returns: the id

getTestNodeDetail

public NodeDetail getTestNodeDetail()

Returns: the NodeDetail from the piece of XML used as the test at the Node where this difference was encountered

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.

toString

public String toString()

Returns: a basic representation of the object state and identity and if NodeDetail instances are populated append their details also