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,java.lang.Iterable<org.w3c.dom.Node>,org.w3c.dom.Node,SingleNodeAssert>
-
- org.xmlunit.assertj3.MultipleNodeAssert
-
- All Implemented Interfaces:
org.assertj.core.api.Assert<MultipleNodeAssert,java.lang.Iterable<org.w3c.dom.Node>>,org.assertj.core.api.Descriptable<MultipleNodeAssert>,org.assertj.core.api.EnumerableAssert<MultipleNodeAssert,org.w3c.dom.Node>,org.assertj.core.api.ExtensionPoints<MultipleNodeAssert,java.lang.Iterable<org.w3c.dom.Node>>,org.assertj.core.api.ObjectEnumerableAssert<MultipleNodeAssert,org.w3c.dom.Node>
public class MultipleNodeAssert extends org.assertj.core.api.FactoryBasedNavigableIterableAssert<MultipleNodeAssert,java.lang.Iterable<org.w3c.dom.Node>,org.w3c.dom.Node,SingleNodeAssert>
Assertion methods forIterableofNode.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceMultipleNodeAssert.SingleNodeAssertConsumer
-
Constructor Summary
Constructors Modifier Constructor Description privateMultipleNodeAssert(java.lang.Iterable<org.w3c.dom.Node> nodes, XPathEngine engine)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidallSatisfy(MultipleNodeAssert.SingleNodeAssertConsumer consumer)private org.assertj.core.api.AbstractListAssert<?,java.util.List<? extends java.lang.String>,java.lang.String,org.assertj.core.api.ObjectAssert<java.lang.String>>asListAssert(java.util.List<java.lang.String> values)MultipleNodeAssertcontainsAllNodesHavingXPath(java.lang.String xPath)Verifies that all of actual nodes have givenxPath.MultipleNodeAssertcontainsAnyNodeHavingXPath(java.lang.String xPath)Verifies that any of actual nodes has givenxPath.(package private) static MultipleNodeAssertcreate(java.lang.Object xmlSource, java.lang.String xPath, XmlAssertConfig config)voiddoNotExist()Equivalent forAbstractIterableAssert.isEmpty().MultipleNodeAssertdoNotHaveAttribute(java.lang.String attributeName)Verifies that all the actual nodes don't have attribute with given name.MultipleNodeAssertdoNotHaveAttribute(java.lang.String attributeName, java.lang.String attributeValue)Verifies that all the actual nodes don't have attribute with given name and value.MultipleNodeAssertexist()Equivalent forAbstractIterableAssert.isNotEmpty().org.assertj.core.api.AbstractListAssert<?,java.util.List<? extends java.lang.String>,java.lang.String,org.assertj.core.api.ObjectAssert<java.lang.String>>extractingAttribute(java.lang.String attribute)Extracting values of given node's attribute.org.assertj.core.api.AbstractListAssert<?,java.util.List<? extends java.lang.String>,java.lang.String,org.assertj.core.api.ObjectAssert<java.lang.String>>extractingText()Extracting text content of given nodes.MultipleNodeAsserthaveAttribute(java.lang.String attributeName)Verifies that all the actual nodes have attribute with given name.MultipleNodeAsserthaveAttribute(java.lang.String attributeName, java.lang.String attributeValue)Verifies that all the actual nodes have attribute with given name and value.-
Methods inherited from class org.assertj.core.api.FactoryBasedNavigableIterableAssert
assertThat, newAbstractIterableAssert, toAssert
-
Methods inherited from class org.assertj.core.api.AbstractIterableAssert
allMatch, allMatch, allSatisfy, allSatisfy, anyMatch, anyMatch, anySatisfy, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, contains, containsAll, containsAnyElementsOf, containsAnyOf, containsAnyOfForProxy, containsExactly, containsExactlyElementsOf, containsExactlyForProxy, containsExactlyInAnyOrder, containsExactlyInAnyOrderElementsOf, containsExactlyInAnyOrderForProxy, containsForProxy, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyForProxy, containsOnlyNulls, containsOnlyOnce, containsOnlyOnceElementsOf, containsOnlyOnceForProxy, containsSequence, containsSequence, containsSequenceForProxy, containsSubsequence, containsSubsequence, containsSubsequenceForProxy, describedAs, describedAs, doesNotContain, doesNotContainAnyElementsOf, doesNotContainForProxy, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSequenceForProxy, doesNotContainSubsequence, doesNotContainSubsequence, doesNotContainSubsequenceForProxy, doesNotHave, doesNotHaveAnyElementsOfTypes, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, element, element, elements, endsWith, endsWith, endsWithForProxy, extracting, extracting, extracting, extracting, extracting, extracting, extractingForProxy, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnAssertions, filteredOnAssertions, filteredOnNull, first, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtractingForProxy, flatMap, flatMap, flatMap, flatMap, getComparatorsByType, getComparatorsForElementPropertyOrFieldTypes, has, hasAtLeastOneElementOfType, hasExactlyElementsOfTypes, 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, isSubsetOfForProxy, last, last, map, map, map, navigationDescription, newAbstractIterableAssertForProxy, noneMatch, noneMatch, noneSatisfy, noneSatisfy, overridingErrorMessage, satisfiesExactly, satisfiesExactly, satisfiesExactlyForProxy, satisfiesExactlyInAnyOrder, satisfiesExactlyInAnyOrder, satisfiesExactlyInAnyOrderForProxy, satisfiesOnlyOnce, satisfiesOnlyOnce, satisfiesOnlyOnceForProxy, singleElement, singleElement, size, startsWith, startsWithForProxy, usingComparator, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparatorForType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, usingRecursiveFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparatorIgnoringFields, usingRecursiveFieldByFieldElementComparatorOnFields, withFailMessage, withThreadDumpOnError, zipSatisfy
-
Methods inherited from class org.assertj.core.api.AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, descriptionText, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, hashCode, hasSameHashCodeAs, hasToString, isElementOfCustomAssert, isInstanceOfSatisfying, isNull, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingEquals, usingEquals, withFailMessage, withRepresentation
-
-
-
-
Constructor Detail
-
MultipleNodeAssert
private MultipleNodeAssert(java.lang.Iterable<org.w3c.dom.Node> nodes, XPathEngine engine)
-
-
Method Detail
-
create
static MultipleNodeAssert create(java.lang.Object xmlSource, java.lang.String xPath, XmlAssertConfig config)
-
exist
public MultipleNodeAssert exist()
Equivalent forAbstractIterableAssert.isNotEmpty().- Returns:
- this
-
doNotExist
public void doNotExist()
Equivalent forAbstractIterableAssert.isEmpty().
-
haveAttribute
public MultipleNodeAssert haveAttribute(java.lang.String attributeName)
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:
java.lang.AssertionError- if the actual nodes iterable isnull.java.lang.AssertionError- if one or more nodes don't have attribute with given name.
-
haveAttribute
public MultipleNodeAssert haveAttribute(java.lang.String attributeName, java.lang.String attributeValue)
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:
java.lang.AssertionError- if the actual nodes iterable isnull.java.lang.AssertionError- if one or more nodes don't have attribute with given name and value.
-
doNotHaveAttribute
public MultipleNodeAssert doNotHaveAttribute(java.lang.String attributeName)
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:
java.lang.AssertionError- if the actual nodes iterable isnull.java.lang.AssertionError- if any node has attribute with given name.
-
doNotHaveAttribute
public MultipleNodeAssert doNotHaveAttribute(java.lang.String attributeName, java.lang.String attributeValue)
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:
java.lang.AssertionError- if the actual nodes iterable isnull.java.lang.AssertionError- if any node has attribute with given name and value.
-
containsAnyNodeHavingXPath
public MultipleNodeAssert containsAnyNodeHavingXPath(java.lang.String xPath)
Verifies that any of actual nodes has givenxPath.- Parameters:
xPath- XPath expression to test- Returns:
- this
- Throws:
java.lang.AssertionError- if the actual nodes iterable isnull.java.lang.AssertionError- if all nodes don't have xpath.- Since:
- XMLUnit 2.6.4
-
containsAllNodesHavingXPath
public MultipleNodeAssert containsAllNodesHavingXPath(java.lang.String xPath)
Verifies that all of actual nodes have givenxPath.- Parameters:
xPath- XPath expression to test- Returns:
- this
- Throws:
java.lang.AssertionError- if the actual nodes iterable isnull.java.lang.AssertionError- if some node doesn't have xpath.- Since:
- XMLUnit 2.6.4
-
extractingAttribute
public org.assertj.core.api.AbstractListAssert<?,java.util.List<? extends java.lang.String>,java.lang.String,org.assertj.core.api.ObjectAssert<java.lang.String>> extractingAttribute(java.lang.String attribute)
Extracting values of given node's attribute. If a node doesn't have the attribute thennullvalue is return.- Parameters:
attribute- name of the attribute- Returns:
- list assert of attribute values
- Throws:
java.lang.AssertionError- if the actual nodes iterable isnull.- Since:
- XMLUnit 2.6.4
-
extractingText
public org.assertj.core.api.AbstractListAssert<?,java.util.List<? extends java.lang.String>,java.lang.String,org.assertj.core.api.ObjectAssert<java.lang.String>> extractingText()
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:
java.lang.AssertionError- if the actual nodes iterable isnull.- Since:
- XMLUnit 2.8.0
-
allSatisfy
private void allSatisfy(MultipleNodeAssert.SingleNodeAssertConsumer consumer)
-
asListAssert
private org.assertj.core.api.AbstractListAssert<?,java.util.List<? extends java.lang.String>,java.lang.String,org.assertj.core.api.ObjectAssert<java.lang.String>> asListAssert(java.util.List<java.lang.String> values)
-
-