Class 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 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.6.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static AssertFactoryProvider ASSERT_FACTORY_PROVIDER  
      • Fields inherited from class org.assertj.core.api.AbstractIterableAssert

        iterables
      • Fields inherited from class org.assertj.core.api.AbstractAssert

        actual, info, myself
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MultipleNodeAssert​(java.lang.Iterable<org.w3c.dom.Node> nodes, JAXPXPathEngine engine)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void allSatisfy​(MultipleNodeAssert.SingleNodeAssertConsumer consumer)  
      MultipleNodeAssert containsAllNodesHavingXPath​(java.lang.String xPath)
      Verifies that all of actual nodes have given xPath.
      MultipleNodeAssert containsAnyNodeHavingXPath​(java.lang.String xPath)
      Verifies that any of actual nodes has given xPath.
      (package private) static MultipleNodeAssert create​(java.lang.Object xmlSource, java.util.Map<java.lang.String,​java.lang.String> prefix2Uri, javax.xml.parsers.DocumentBuilderFactory dbf, javax.xml.xpath.XPathFactory xpf, java.lang.String xPath)  
      void doNotExist()
      Equivalent for AbstractIterableAssert.isEmpty().
      MultipleNodeAssert doNotHaveAttribute​(java.lang.String attributeName)
      Verifies that all the actual nodes don't have attribute with given name.
      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.
      MultipleNodeAssert exist()
      Equivalent for AbstractIterableAssert.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.
      MultipleNodeAssert haveAttribute​(java.lang.String attributeName)
      Verifies that all the actual nodes have attribute with given name.
      MultipleNodeAssert haveAttribute​(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

        toAssert
      • Methods inherited from class org.assertj.core.api.AbstractIterableAssert

        allMatch, allMatch, allSatisfy, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, contains, containsAll, containsExactly, containsExactlyElementsOf, containsExactlyInAnyOrder, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyOnce, containsSequence, containsSequence, containsSubsequence, containsSubsequence, describedAs, describedAs, doesNotContain, doesNotContainAnyElementsOf, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSubsequence, doesNotContainSubsequence, doesNotHave, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, element, endsWith, extracting, extracting, extracting, extracting, extracting, extracting, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnNull, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, has, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameClassAs, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, 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, navigationDescription, newListAssertInstance, overridingErrorMessage, size, startsWith, toLazyIterable, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, withFailMessage, withThreadDumpOnError
      • Methods inherited from class org.assertj.core.api.AbstractAssert

        asList, asString, descriptionText, equals, failWithMessage, getWritableAssertionInfo, hashCode, isInstanceOfSatisfying, isNull, matches, matches, satisfies, setCustomRepresentation, throwAssertionError, withRepresentation
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MultipleNodeAssert

        private MultipleNodeAssert​(java.lang.Iterable<org.w3c.dom.Node> nodes,
                                   JAXPXPathEngine engine)
    • Method Detail

      • create

        static MultipleNodeAssert create​(java.lang.Object xmlSource,
                                         java.util.Map<java.lang.String,​java.lang.String> prefix2Uri,
                                         javax.xml.parsers.DocumentBuilderFactory dbf,
                                         javax.xml.xpath.XPathFactory xpf,
                                         java.lang.String xPath)
      • exist

        public MultipleNodeAssert exist()
        Equivalent for AbstractIterableAssert.isNotEmpty().
      • doNotExist

        public void doNotExist()
        Equivalent for AbstractIterableAssert.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.

        Throws:
        java.lang.AssertionError - if the actual nodes iterable is null.
        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.

        Throws:
        java.lang.AssertionError - if the actual nodes iterable is null.
        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.

        Throws:
        java.lang.AssertionError - if the actual nodes iterable is null.
        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.

        Throws:
        java.lang.AssertionError - if the actual nodes iterable is null.
        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 given xPath.
        Throws:
        java.lang.AssertionError - if the actual nodes iterable is null.
        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 given xPath.
        Throws:
        java.lang.AssertionError - if the actual nodes iterable is null.
        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 then null value is return.
        Throws:
        java.lang.AssertionError - if the actual nodes iterable is null.
        Since:
        XMLUnit 2.6.4