Package org.xmlunit.diff
Class DifferenceEvaluators
- java.lang.Object
-
- org.xmlunit.diff.DifferenceEvaluators
-
public final class DifferenceEvaluators extends Object
Evaluators used for the base cases.
-
-
Field Summary
Fields Modifier and Type Field Description static DifferenceEvaluatorAcceptDifference evaluator that just echos the result passed in.static DifferenceEvaluatorDefaultThe "standard" difference evaluator which decides which differences make two XML documents really different and which still leave them similar.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DifferenceEvaluatorchain(DifferenceEvaluator... evaluators)Combines multiple DifferenceEvaluators so that the result of the first Evaluator will be passed to the next Evaluator.static DifferenceEvaluatordowngradeDifferencesToEqual(ComparisonType... types)Creates a DifferenceEvaluator that returns a EQUAL result for differences found in one of the given ComparisonTypes.static DifferenceEvaluatordowngradeDifferencesToSimilar(ComparisonType... types)Creates a DifferenceEvaluator that returns a SIMILAR result for differences (Comparisons that are not EQUAL) found in one of the given ComparisonTypes.static DifferenceEvaluatorfirst(DifferenceEvaluator... evaluators)Combines multiple DifferenceEvaluators so that the first one that changes the outcome wins.static DifferenceEvaluatorignorePrologDifferences()Ignore any differences that are part of the XML prolog.static DifferenceEvaluatorignorePrologDifferencesExceptDoctype()Ignore any differences except differences inside the doctype declaration that are part of the XML prolog.static DifferenceEvaluatorupgradeDifferencesToDifferent(ComparisonType... types)Creates a DifferenceEvaluator that returns a DIFFERENT result for differences (Comparisons that are not EQUAL) found in one of the given ComparisonTypes.
-
-
-
Field Detail
-
Accept
public static final DifferenceEvaluator Accept
Difference evaluator that just echos the result passed in.
-
Default
public static final DifferenceEvaluator Default
The "standard" difference evaluator which decides which differences make two XML documents really different and which still leave them similar.
-
-
Method Detail
-
first
public static DifferenceEvaluator first(DifferenceEvaluator... evaluators)
Combines multiple DifferenceEvaluators so that the first one that changes the outcome wins.- Parameters:
evaluators- the evaluators to combine- Returns:
- the DifferenceEvaluator
-
chain
public static DifferenceEvaluator chain(DifferenceEvaluator... evaluators)
Combines multiple DifferenceEvaluators so that the result of the first Evaluator will be passed to the next Evaluator.- Parameters:
evaluators- the evaluators to combine- Returns:
- the DifferenceEvaluator
-
downgradeDifferencesToEqual
public static DifferenceEvaluator downgradeDifferencesToEqual(ComparisonType... types)
Creates a DifferenceEvaluator that returns a EQUAL result for differences found in one of the given ComparisonTypes.- Parameters:
types- the ComparisonTypes the change applies to- Returns:
- the DifferenceEvaluator
- Since:
- XMLUnit 2.1.0
-
downgradeDifferencesToSimilar
public static DifferenceEvaluator downgradeDifferencesToSimilar(ComparisonType... types)
Creates a DifferenceEvaluator that returns a SIMILAR result for differences (Comparisons that are not EQUAL) found in one of the given ComparisonTypes.- Parameters:
types- the ComparisonTypes the change applies to- Returns:
- the DifferenceEvaluator
- Since:
- XMLUnit 2.1.0
-
upgradeDifferencesToDifferent
public static DifferenceEvaluator upgradeDifferencesToDifferent(ComparisonType... types)
Creates a DifferenceEvaluator that returns a DIFFERENT result for differences (Comparisons that are not EQUAL) found in one of the given ComparisonTypes.- Parameters:
types- the ComparisonTypes the change applies to- Returns:
- the DifferenceEvaluator
- Since:
- XMLUnit 2.1.0
-
ignorePrologDifferences
public static DifferenceEvaluator ignorePrologDifferences()
Ignore any differences that are part of the XML prolog.Here "ignore" means return
ComparisonResult.EQUAL.- Returns:
- the DifferenceEvaluator
- Since:
- XMLUnit 2.1.0
-
ignorePrologDifferencesExceptDoctype
public static DifferenceEvaluator ignorePrologDifferencesExceptDoctype()
Ignore any differences except differences inside the doctype declaration that are part of the XML prolog.Here "ignore" means return
ComparisonResult.EQUAL.This is one of the building blocks for mimicing the behavior of XMLUnit for Java 1.x. In order to get the same behavior you need:
chain(Default, // so CDATA and Text are the same ignorePrologDifferencesExceptDoctype()) // so most of the prolog is ignoredIn general different doctype declarations will be ignored because of
NodeFilters.Default, so if you want to detect these differences you need to pick a differentNodeFilter.- Returns:
- the DifferenceEvaluator
- Since:
- XMLUnit 2.1.0
-
-