Package org.xmlunit.assertj3
Class MultipleNodeAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.assertj.core.api.AbstractIterableAssert<SELF,ACTUAL,ELEMENT,ELEMENT_ASSERT>
org.assertj.core.api.FactoryBasedNavigableIterableAssert<MultipleNodeAssert,Iterable<Node>,Node,SingleNodeAssert>
org.xmlunit.assertj3.MultipleNodeAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<MultipleNodeAssert,
,Iterable<Node>> org.assertj.core.api.Descriptable<MultipleNodeAssert>
,org.assertj.core.api.EnumerableAssert<MultipleNodeAssert,
,Node> org.assertj.core.api.ExtensionPoints<MultipleNodeAssert,
,Iterable<Node>> org.assertj.core.api.ObjectEnumerableAssert<MultipleNodeAssert,
Node>
public class MultipleNodeAssert
extends org.assertj.core.api.FactoryBasedNavigableIterableAssert<MultipleNodeAssert,Iterable<Node>,Node,SingleNodeAssert>
Assertion methods for
Iterable
of Node
.
Simple Example
import static org.xmlunit.assertj.XmlAssert.assertThat; final String xml = "<a><b attr=\"abc\"></b></a>"; assertThat(xml).nodesByXPath("//a/b").haveAttribute("attr").
- Since:
- XMLUnit 2.8.1
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractIterableAssert
iterables
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Method Summary
Modifier and TypeMethodDescriptionVerifies that all of actual nodes have givenxPath
.containsAnyNodeHavingXPath
(String xPath) Verifies that any of actual nodes has givenxPath
.void
Equivalent forAbstractIterableAssert.isEmpty()
.doNotHaveAttribute
(String attributeName) Verifies that all the actual nodes don't have attribute with given name.doNotHaveAttribute
(String attributeName, String attributeValue) Verifies that all the actual nodes don't have attribute with given name and value.exist()
Equivalent forAbstractIterableAssert.isNotEmpty()
.org.assertj.core.api.AbstractListAssert<?,
List<? extends String>, String, org.assertj.core.api.ObjectAssert<String>> extractingAttribute
(String attribute) Extracting values of given node's attribute.org.assertj.core.api.AbstractListAssert<?,
List<? extends String>, String, org.assertj.core.api.ObjectAssert<String>> Extracting text content of given nodes.haveAttribute
(String attributeName) Verifies that all the actual nodes have attribute with given name.haveAttribute
(String attributeName, String attributeValue) Verifies that all the actual nodes have attribute with given name and value.Methods inherited from class org.assertj.core.api.FactoryBasedNavigableIterableAssert
newAbstractIterableAssert, toAssert
Methods inherited from class org.assertj.core.api.AbstractIterableAssert
allMatch, allMatch, allSatisfy, anyMatch, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, contains, containsAll, containsAnyElementsOf, containsAnyOf, containsExactly, containsExactlyElementsOf, containsExactlyInAnyOrder, containsExactlyInAnyOrderElementsOf, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyNulls, containsOnlyOnce, containsOnlyOnceElementsOf, containsSequence, containsSequence, containsSubsequence, containsSubsequence, describedAs, describedAs, doesNotContain, doesNotContainAnyElementsOf, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSubsequence, doesNotContainSubsequence, doesNotHave, doesNotHaveAnyElementsOfTypes, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, element, element, endsWith, endsWith, extracting, extracting, extracting, extracting, extracting, extracting, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnAssertions, filteredOnNull, first, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatMap, flatMap, flatMap, flatMap, getComparatorsByType, getComparatorsForElementPropertyOrFieldTypes, has, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameClassAs, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasSizeBetween, hasSizeGreaterThan, hasSizeGreaterThanOrEqualTo, hasSizeLessThan, hasSizeLessThanOrEqualTo, hasToString, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, inBinary, inHexadecimal, is, isEmpty, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEmpty, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNullOrEmpty, isOfAnyClassIn, isSameAs, isSubsetOf, isSubsetOf, last, last, map, map, map, navigationDescription, noneMatch, noneSatisfy, overridingErrorMessage, singleElement, singleElement, size, startsWith, usingComparator, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparatorForType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveComparison, usingRecursiveComparison, usingRecursiveFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, withFailMessage, withThreadDumpOnError, zipSatisfy
Methods inherited from class org.assertj.core.api.AbstractAssert
asInstanceOf, asList, assertionError, asString, descriptionText, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, hashCode, hasSameHashCodeAs, isElementOfCustomAssert, isInstanceOfSatisfying, isNull, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, withFailMessage, withRepresentation
-
Method Details
-
exist
Equivalent forAbstractIterableAssert.isNotEmpty()
.- Returns:
- this
-
doNotExist
public void doNotExist()Equivalent forAbstractIterableAssert.isEmpty()
. -
haveAttribute
Verifies that all the actual nodes have attribute with given name.If the actual nodes iterable is empty, this assertion succeeds as there is no elements to check.
- Parameters:
attributeName
- name of the expected attribute- Returns:
- this
- Throws:
AssertionError
- if the actual nodes iterable isnull
.AssertionError
- if one or more nodes don't have attribute with given name.
-
haveAttribute
Verifies that all the actual nodes have attribute with given name and value.If the actual nodes iterable is empty, this assertion succeeds as there is no elements to check.
- Parameters:
attributeName
- name of the expected attributeattributeValue
- expected attribute value- Returns:
- this
- Throws:
AssertionError
- if the actual nodes iterable isnull
.AssertionError
- if one or more nodes don't have attribute with given name and value.
-
doNotHaveAttribute
Verifies that all the actual nodes don't have attribute with given name.If the actual nodes iterable is empty, this assertion succeeds as there is no elements to check.
- Parameters:
attributeName
- name of the expected attribute- Returns:
- this
- Throws:
AssertionError
- if the actual nodes iterable isnull
.AssertionError
- if any node has attribute with given name.
-
doNotHaveAttribute
Verifies that all the actual nodes don't have attribute with given name and value.If the actual nodes iterable is empty, this assertion succeeds as there is no elements to check.
- Parameters:
attributeName
- name of the expected attributeattributeValue
- expected attribute value- Returns:
- this
- Throws:
AssertionError
- if the actual nodes iterable isnull
.AssertionError
- if any node has attribute with given name and value.
-
containsAnyNodeHavingXPath
Verifies that any of actual nodes has givenxPath
.- Parameters:
xPath
- XPath expression to test- Returns:
- this
- Throws:
AssertionError
- if the actual nodes iterable isnull
.AssertionError
- if all nodes don't have xpath.- Since:
- XMLUnit 2.6.4
-
containsAllNodesHavingXPath
Verifies that all of actual nodes have givenxPath
.- Parameters:
xPath
- XPath expression to test- Returns:
- this
- Throws:
AssertionError
- if the actual nodes iterable isnull
.AssertionError
- if some node doesn't have xpath.- Since:
- XMLUnit 2.6.4
-
extractingAttribute
public org.assertj.core.api.AbstractListAssert<?,List<? extends String>, extractingAttributeString, org.assertj.core.api.ObjectAssert<String>> (String attribute) Extracting values of given node's attribute. If a node doesn't have the attribute thennull
value is return.- Parameters:
attribute
- name of the attribute- Returns:
- list assert of attribute values
- Throws:
AssertionError
- if the actual nodes iterable isnull
.- Since:
- XMLUnit 2.6.4
-
extractingText
public org.assertj.core.api.AbstractListAssert<?,List<? extends String>, extractingText()String, org.assertj.core.api.ObjectAssert<String>> Extracting text content of given nodes. If a node doesn't have the text then an empty string is returned.- Returns:
- list assert of text content
- Throws:
AssertionError
- if the actual nodes iterable isnull
.- Since:
- XMLUnit 2.8.0
-