Package org.custommonkey.xmlunit
Class NewDifferenceEngine
- java.lang.Object
-
- org.custommonkey.xmlunit.NewDifferenceEngine
-
- All Implemented Interfaces:
DifferenceConstants,DifferenceEngineContract
public class NewDifferenceEngine extends Object implements DifferenceConstants, DifferenceEngineContract
Class that has responsibility for comparing Nodes and notifying a DifferenceListener of any differences or dissimilarities that are found. Knows how to compare namespaces and nested child nodes, but currently only compares nodes of type ELEMENT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_TYPE_NODE, PROCESSING_INSTRUCTION_NODE and TEXT_NODE. Nodes of other types (eg ENTITY_NODE) will be skipped.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNewDifferenceEngine.ComparisonController2ComparisonControllerAdapts XMLUnit 1.x ComparisonController to XMLUnit 2.x ComparisonController.static classNewDifferenceEngine.DifferenceListener2DifferenceEvaluatorAdapts XMLUnit 1.x DifferenceListener to XMLUnit 2.x DifferenceEvaluator.static classNewDifferenceEngine.ElementQualifier2ElementSelectorAdapts XMLUnit 1.x ComparisonQualifider to XMLUnit 2.x ElementSelector.static classNewDifferenceEngine.MatchTracker2ComparisonListenerAdapts XMLUnit 1.x MatchTracker to XMLUnit 2.x ComparisonListener.
-
Field Summary
-
Fields inherited from interface org.custommonkey.xmlunit.DifferenceConstants
ATTR_NAME_NOT_FOUND, ATTR_NAME_NOT_FOUND_ID, ATTR_SEQUENCE, ATTR_SEQUENCE_ID, ATTR_VALUE, ATTR_VALUE_EXPLICITLY_SPECIFIED, ATTR_VALUE_EXPLICITLY_SPECIFIED_ID, ATTR_VALUE_ID, CDATA_VALUE, CDATA_VALUE_ID, CHILD_NODE_NOT_FOUND, CHILD_NODE_NOT_FOUND_ID, CHILD_NODELIST_LENGTH, CHILD_NODELIST_LENGTH_ID, CHILD_NODELIST_SEQUENCE, CHILD_NODELIST_SEQUENCE_ID, COMMENT_VALUE, COMMENT_VALUE_ID, DOCTYPE_NAME, DOCTYPE_NAME_ID, DOCTYPE_PUBLIC_ID, DOCTYPE_PUBLIC_ID_ID, DOCTYPE_SYSTEM_ID, DOCTYPE_SYSTEM_ID_ID, ELEMENT_NUM_ATTRIBUTES, ELEMENT_NUM_ATTRIBUTES_ID, ELEMENT_TAG_NAME, ELEMENT_TAG_NAME_ID, HAS_CHILD_NODES, HAS_CHILD_NODES_ID, HAS_DOCTYPE_DECLARATION, HAS_DOCTYPE_DECLARATION_ID, NAMESPACE_PREFIX, NAMESPACE_PREFIX_ID, NAMESPACE_URI, NAMESPACE_URI_ID, NO_NAMESPACE_SCHEMA_LOCATION, NO_NAMESPACE_SCHEMA_LOCATION_ID, NODE_TYPE, NODE_TYPE_ID, PROCESSING_INSTRUCTION_DATA, PROCESSING_INSTRUCTION_DATA_ID, PROCESSING_INSTRUCTION_TARGET, PROCESSING_INSTRUCTION_TARGET_ID, SCHEMA_LOCATION, SCHEMA_LOCATION_ID, TEXT_VALUE, TEXT_VALUE_ID
-
-
Constructor Summary
Constructors Constructor Description NewDifferenceEngine(ComparisonController controller)Simple constructor that uses no MatchTracker at all.NewDifferenceEngine(ComparisonController controller, MatchTracker matchTracker)Simple constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompare(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier)Entry point for Node comparison testing.voidsetMatchTracker(MatchTracker matchTracker)static Iterable<Difference>toDifference(Comparison comp)Maps a Comparison to Differences.static NodeDetailtoNodeDetail(Comparison.Detail detail)Maps node details.
-
-
-
Constructor Detail
-
NewDifferenceEngine
public NewDifferenceEngine(ComparisonController controller)
Simple constructor that uses no MatchTracker at all.- Parameters:
controller- the instance used to determine whether a Difference detected by this class should halt further comparison or not- See Also:
ComparisonController.haltComparison(Difference)
-
NewDifferenceEngine
public NewDifferenceEngine(ComparisonController controller, MatchTracker matchTracker)
Simple constructor- Parameters:
controller- the instance used to determine whether a Difference detected by this class should halt further comparison or notmatchTracker- the instance that is notified on each successful match. May be null.- See Also:
ComparisonController.haltComparison(Difference),MatchTracker.matchFound(Difference)
-
-
Method Detail
-
setMatchTracker
public void setMatchTracker(MatchTracker matchTracker)
- Specified by:
setMatchTrackerin interfaceDifferenceEngineContract- Parameters:
matchTracker- the instance that is notified on each successful match. May be null.
-
compare
public void compare(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier)
Entry point for Node comparison testing.- Specified by:
comparein interfaceDifferenceEngineContract- Parameters:
control- Control XML to comparetest- Test XML to comparelistener- Notified of anydifferencesdetected during node comparison testingelementQualifier- Used to determine which elements qualify for comparison e.g. when a node has repeated child elements that may occur in any sequence and that sequence is not considered important.
-
toDifference
public static Iterable<Difference> toDifference(Comparison comp)
Maps a Comparison to Differences.- Parameters:
comp- comparison to map- Returns:
- Differences
-
toNodeDetail
public static NodeDetail toNodeDetail(Comparison.Detail detail)
Maps node details.- Parameters:
detail- XMLUnit 2.x detail- Returns:
- XMLUnit 1.x detail
-
-