Interface ListAttributeAssert

  • All Superinterfaces:
    AttributeAssert<org.assertj.core.api.ListAssert<String>>
    All Known Implementing Classes:
    FluentListAssert

    public interface ListAttributeAssert
    extends AttributeAssert<org.assertj.core.api.ListAssert<String>>
    Assertion interface for attribute validation within a list of elements.
    • Method Detail

      • hasAttribute

        org.assertj.core.api.ListAssert<String> hasAttribute​(String attribute)
        Checks if at least one of the elements in the list of elements has the given property.

        It allows users to do not just presence validation but to apply chained List assertions to further validate the attribute values.

        Examples:

        Validating the presence of an attribute on a FluentList:

         assertThat(fluentList).hasAttribute("class");
         

        Validating both the presence of an attribute on a fluent list, and the value of that attribute:

         assertThat(element).hasAttribute("class").containsAnyOf("some-class", "other-class");
         
        Specified by:
        hasAttribute in interface AttributeAssert<org.assertj.core.api.ListAssert<String>>
        Parameters:
        attribute - the attribute to find
        Returns:
        a new ListAssert object with the actual attribute values