public interface DifferenceEngineConfigurer<D extends DifferenceEngineConfigurer<D>>
DifferenceEngine.| Modifier and Type | Method and Description |
|---|---|
D |
withAttributeFilter(Predicate<Attr> attributeFilter)
Registers a filter for attributes.
|
D |
withComparisonController(ComparisonController comparisonController)
Replace the
ComparisonControllers.Default with your own ComparisonController. |
D |
withComparisonFormatter(ComparisonFormatter formatter)
Sets a non-default formatter for the differences found.
|
D |
withComparisonListeners(ComparisonListener... comparisonListeners)
Registers listeners that are notified of each comparison.
|
D |
withDifferenceEvaluator(DifferenceEvaluator differenceEvaluator)
Provide your own custom
DifferenceEvaluator implementation. |
D |
withDifferenceListeners(ComparisonListener... comparisonListeners)
Registers listeners that are notified of each comparison with
outcome other than
ComparisonResult.EQUAL. |
D |
withNamespaceContext(Map<String,String> prefix2Uri)
Establish a namespace context that will be used in
Comparison.Detail#getXPath. |
D |
withNodeFilter(Predicate<Node> nodeFilter)
Registers a filter for nodes.
|
D |
withNodeMatcher(NodeMatcher nodeMatcher)
Sets the strategy for selecting nodes to compare.
|
D withNodeMatcher(NodeMatcher nodeMatcher)
Example with DefaultNodeMatcher:
.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))
This overwrites any NodeMatcher set via earlier invocations of withNodeMatcher.
nodeMatcher - the NodeMatcher to useDifferenceEngine.setNodeMatcher(NodeMatcher)D withDifferenceEvaluator(DifferenceEvaluator differenceEvaluator)
DifferenceEvaluator implementation.
This overwrites the Default DifferenceEvaluator.
If you want use your custom DifferenceEvaluator in
combination with the default or another DifferenceEvaluator you
should use DifferenceEvaluators.chain(DifferenceEvaluator...) or DifferenceEvaluators.first(DifferenceEvaluator...) to combine
them:
.withDifferenceEvaluator(
DifferenceEvaluators.chain(
DifferenceEvaluators.Default,
new MyCustomDifferenceEvaluator()))
....
This overwrites any DifferenceEvaluator set via earlier invocations of withDifferenceEvaluator.
differenceEvaluator - the DifferenceEvaluator to useD withComparisonController(ComparisonController comparisonController)
ComparisonControllers.Default with your own ComparisonController.
Example use:
.withComparisonController(ComparisonControllers.StopWhenDifferent)
This overwrites any ComparisonController set via earlier invocations of withComparisonController.
comparisonController - ComparisonController to useD withComparisonListeners(ComparisonListener... comparisonListeners)
comparisonListeners - ComparisonListeners to useThis overwrites any {@link ComparisonListener}s set via earlier invocations of {@code withComparisonListeners}.
D withDifferenceListeners(ComparisonListener... comparisonListeners)
ComparisonResult.EQUAL.
This overwrites any ComparisonListeners set via earlier invocations of withDifferenceListeners.
comparisonListeners - ComparisonListeners to useDifferenceEngine.addDifferenceListener(ComparisonListener)D withNamespaceContext(Map<String,String> prefix2Uri)
Comparison.Detail#getXPath.
Without a namespace context (or with an empty context) the XPath expressions will only use local names for elements and attributes.
This overwrites any Map set via earlier invocations of withNamespaceContext.
prefix2Uri - mapping between prefix and namespace URID withAttributeFilter(Predicate<Attr> attributeFilter)
Only attributes for which the predicate returns true are part of the comparison. By default all attributes are considered.
The "special" namespace, namespace-location and
schema-instance-type attributes can not be ignored this way.
If you want to suppress comparison of them you'll need to
implement DifferenceEvaluator.
This overwrites any Predicate set via earlier invocations of withAttributeFilter.
attributeFilter - attribute filter to useD withNodeFilter(Predicate<Node> nodeFilter)
Only nodes for which the predicate returns true are part of the comparison. By default nodes that are not document types are considered.
This overwrites any Predicate set via earlier invocations of withNodeFilter.
nodeFilter - node filter to useD withComparisonFormatter(ComparisonFormatter formatter)
This overwrites any ComparisonFormatter set via earlier invocations of withComparisonFormatter.
formatter - formatter to useCopyright © 2001–2025 XMLUnit. All rights reserved.