Package org.xmlunit.assertj
Class CompareAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.xmlunit.assertj.CompareAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<CompareAssert,,Object> org.assertj.core.api.Descriptable<CompareAssert>,org.assertj.core.api.ExtensionPoints<CompareAssert,,Object> DifferenceEngineConfigurer<CompareAssert>
public class CompareAssert
extends org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
implements DifferenceEngineConfigurer<CompareAssert>
Assertion methods for XMLs comparison.
Simple Example
import static org.xmlunit.assertj.XmlAssert.assertThat; final String control = "<a><b attr=\"abc\"></b></a>"; final String test = "<a><b attr=\"xyz\"NodeAssertFactory></b></a>"; assertThat(test).and(control).areIdentical(); assertThat(test).and(control).areNotSimilar();
- Since:
- XMLUnit 2.6.1
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself -
Method Summary
Modifier and TypeMethodDescriptionCheck if actual and control XMLs are identical.Check if actual and control XMLs are not identical.Check if actual and control XMLs are not similar.Check if actual and control XMLs are similar.Equivalent forWill remove all comment-Tags "<!ignoreCommentsUsingXSLTVersion(String xsltVersion) Will remove all comment-Tags "<!Ignore element content whitespace by removing all text nodes solely consisting of whitespace.Ignore whitespace by removing all empty text nodes and trimming the non-empty ones.Normalize Text-Elements by removing all empty text nodes and normalizing the non-empty ones.withAttributeFilter(Predicate<Attr> attributeFilter) withComparisonController(ComparisonController comparisonController) withComparisonFormatter(ComparisonFormatter formatter) withComparisonListeners(ComparisonListener... comparisonListeners) withDifferenceEvaluator(DifferenceEvaluator differenceEvaluator) withDifferenceListeners(ComparisonListener... comparisonListeners) withNamespaceContext(Map<String, String> prefix2Uri) withNodeFilter(Predicate<Node> nodeFilter) withNodeMatcher(NodeMatcher nodeMatcher) Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, setCustomRepresentation, throwAssertionError, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
-
Method Details
-
withNodeMatcher
- Specified by:
withNodeMatcherin interfaceDifferenceEngineConfigurer<CompareAssert>- See Also:
-
withDifferenceEvaluator
- Specified by:
withDifferenceEvaluatorin interfaceDifferenceEngineConfigurer<CompareAssert>- See Also:
-
withComparisonController
- Specified by:
withComparisonControllerin interfaceDifferenceEngineConfigurer<CompareAssert>- See Also:
-
withComparisonListeners
- Specified by:
withComparisonListenersin interfaceDifferenceEngineConfigurer<CompareAssert>- See Also:
-
withDifferenceListeners
- Specified by:
withDifferenceListenersin interfaceDifferenceEngineConfigurer<CompareAssert>- See Also:
-
withNamespaceContext
- Specified by:
withNamespaceContextin interfaceDifferenceEngineConfigurer<CompareAssert>- See Also:
-
withAttributeFilter
- Specified by:
withAttributeFilterin interfaceDifferenceEngineConfigurer<CompareAssert>- See Also:
-
withNodeFilter
- Specified by:
withNodeFilterin interfaceDifferenceEngineConfigurer<CompareAssert>- See Also:
-
withComparisonFormatter
- Specified by:
withComparisonFormatterin interfaceDifferenceEngineConfigurer<CompareAssert>- See Also:
-
withDocumentBuilderFactory
- Parameters:
f- the DocumentBuilderFactory to use- Returns:
- this
- See Also:
-
ignoreWhitespace
Ignore whitespace by removing all empty text nodes and trimming the non-empty ones.- Returns:
- this
- See Also:
-
normalizeWhitespace
Normalize Text-Elements by removing all empty text nodes and normalizing the non-empty ones.- Returns:
- this
- See Also:
-
ignoreElementContentWhitespace
Ignore element content whitespace by removing all text nodes solely consisting of whitespace.- Returns:
- this
- See Also:
-
ignoreComments
Will remove all comment-Tags "<!-- Comment -->" from test- and control-XML before comparing.- Returns:
- this
- See Also:
-
ignoreCommentsUsingXSLTVersion
Will remove all comment-Tags "<!-- Comment -->" from test- and control-XML before comparing.- Parameters:
xsltVersion- use this version for the stylesheet- Returns:
- this
- See Also:
-
ignoreChildNodesOrder
Equivalent for.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)) .withDifferenceEvaluator( chain( Default, DifferenceEvaluators.downgradeDifferencesToEqual(ComparisonType.CHILD_NODELIST_SEQUENCE)));- Returns:
- this
- See Also:
-
areIdentical
Check if actual and control XMLs are identical. If custom comparison controller wasn't defined thenComparisonControllers.StopWhenSimilaris used.- Returns:
- this
- Throws:
AssertionError- if the test value is invalidAssertionError- if the control value is invalid- See Also:
-
areNotIdentical
Check if actual and control XMLs are not identical. If custom comparison controller wasn't defined thenComparisonControllers.StopWhenSimilaris used.- Returns:
- this
- Throws:
AssertionError- if the test value is invalidAssertionError- if the control value is invalid- See Also:
-
areSimilar
Check if actual and control XMLs are similar. If custom comparison controller wasn't defined thenComparisonControllers.StopWhenDifferentis used.- Returns:
- this
- Throws:
AssertionError- if the test value is invalidAssertionError- if the control value is invalid- See Also:
-
areNotSimilar
Check if actual and control XMLs are not similar. If custom comparison controller wasn't defined thenComparisonControllers.StopWhenDifferentis used.- Returns:
- this
- Throws:
AssertionError- if the test value is invalidAssertionError- if the control value is invalid- See Also:
-