Class MultipleNodeAssert

java.lang.Object
org.assertj.core.api.AbstractAssert<MultipleNodeAssert,Iterable<Node>>
org.assertj.core.api.AbstractIterableAssert<MultipleNodeAssert,Iterable<Node>,Node,SingleNodeAssert>
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
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static interface 
     
  • 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
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
     
    private org.assertj.core.api.AbstractListAssert<?,List<? extends String>,String,org.assertj.core.api.ObjectAssert<String>>
     
    Verifies that all of actual nodes have given xPath.
    Verifies that any of actual nodes has given xPath.
    (package private) static MultipleNodeAssert
    create(Object xmlSource, String xPath, XmlAssertConfig config)
     
    void
    Equivalent for AbstractIterableAssert.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.
    Equivalent for AbstractIterableAssert.isNotEmpty().
    org.assertj.core.api.AbstractListAssert<?,List<? extends String>,String,org.assertj.core.api.ObjectAssert<String>>
    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

    assertThat, newAbstractIterableAssert, toAssert

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

    allMatch, allMatch, allSatisfy, allSatisfy, 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, 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

    areEqual, asInstanceOf, asList, assertionError, asString, descriptionText, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, hashCode, hasSameHashCodeAs, isElementOfCustomAssert, isInstanceOfSatisfying, isNull, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, withFailMessage, withRepresentation

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.assertj.core.api.Descriptable

    as
  • Constructor Details

  • Method Details

    • create

      static MultipleNodeAssert create(Object xmlSource, String xPath, XmlAssertConfig config)
    • exist

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

      public void doNotExist()
      Equivalent for AbstractIterableAssert.isEmpty().
    • haveAttribute

      public MultipleNodeAssert haveAttribute(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:
      AssertionError - if the actual nodes iterable is null.
      AssertionError - if one or more nodes don't have attribute with given name.
    • haveAttribute

      public MultipleNodeAssert haveAttribute(String attributeName, 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:
      AssertionError - if the actual nodes iterable is null.
      AssertionError - if one or more nodes don't have attribute with given name and value.
    • doNotHaveAttribute

      public MultipleNodeAssert doNotHaveAttribute(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:
      AssertionError - if the actual nodes iterable is null.
      AssertionError - if any node has attribute with given name.
    • doNotHaveAttribute

      public MultipleNodeAssert doNotHaveAttribute(String attributeName, 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:
      AssertionError - if the actual nodes iterable is null.
      AssertionError - if any node has attribute with given name and value.
    • containsAnyNodeHavingXPath

      public MultipleNodeAssert containsAnyNodeHavingXPath(String xPath)
      Verifies that any of actual nodes has given xPath.
      Throws:
      AssertionError - if the actual nodes iterable is null.
      AssertionError - if all nodes don't have xpath.
      Since:
      XMLUnit 2.6.4
    • containsAllNodesHavingXPath

      public MultipleNodeAssert containsAllNodesHavingXPath(String xPath)
      Verifies that all of actual nodes have given xPath.
      Throws:
      AssertionError - if the actual nodes iterable is null.
      AssertionError - if some node doesn't have xpath.
      Since:
      XMLUnit 2.6.4
    • extractingAttribute

      public 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. If a node doesn't have the attribute then null value is return.
      Throws:
      AssertionError - if the actual nodes iterable is null.
      Since:
      XMLUnit 2.6.4
    • extractingText

      public org.assertj.core.api.AbstractListAssert<?,List<? extends String>,String,org.assertj.core.api.ObjectAssert<String>> extractingText()
      Extracting text content of given nodes. If a node doesn't have the text then an empty string is returned.
      Throws:
      AssertionError - if the actual nodes iterable is null.
      Since:
      XMLUnit 2.8.0
    • allSatisfy

      private void allSatisfy(MultipleNodeAssert.SingleNodeAssertConsumer consumer)
    • asListAssert

      private org.assertj.core.api.AbstractListAssert<?,List<? extends String>,String,org.assertj.core.api.ObjectAssert<String>> asListAssert(List<String> values)