Class FluentListAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<FluentListAssert,
,FluentList> org.assertj.core.api.Descriptable<FluentListAssert>
,org.assertj.core.api.ExtensionPoints<FluentListAssert,
,FluentList> AttributeAssert<org.assertj.core.api.ListAssert<String>>
,FluentAssert
,ListAttributeAssert
,ListStateAssert
FluentList
assertions.
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.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.hasAttributeValue
(String attribute, String value) Checks if the element, or at least one element in a list of elements, has property with the exact given value.Checks if the element, or at least one element in a list of elements, has the class.hasClasses
(String... classesToFind) Checks if the element, or at least one element in a list of elements, has all of the argument classes.hasDimension
(org.openqa.selenium.Dimension dimension) Checks if the element, or at least one element in a list of elements, has given dimension.Checks if the element, or at least one element in a list of elements, has the given idChecks if the element, or at least one element in a list of elements, has given name (in its 'name' attribute).hasNotAttribute
(String attribute) Checks if the element doesn't have, or no element in a list of elements has, the given property.hasNotClass
(String htmlClass) Checks if the element does not contain, or none of the elements in a list of elements contain the classhasNotClasses
(String... htmlClasses) Checks if the element does not contain, or none of the elements in a list of elements contain any of the classes.hasNotText
(String textToFind) Checks if the element does not contain, or none of the elements in a list of elements contain the text.hasNotTextContaining
(String textToFind) Checks if the element does not contain, or none of the elements in a list of elements contain the text.hasSize()
Creates aFluentListSizeBuilder
object from which further size related assertion methods may be called.hasSize
(int expectedSize) Checks whether the list size is the same as the expected one in the argument.hasTagName
(String tagName) Checks if the element, or at least one element in a list of elements, has given tag.Checks if the element, or at least one element in a list of elements, contain the text.hasTextContaining
(String textToFind) Checks if the element, or at least one element in a list of elements, contain the text.hasTextMatching
(String regexToBeMatched) Checks if the element, or at least one element in a list of elements, matches the given regex.Checks if the element, or at least one element in a list of elements has given value (in its 'value' attribute).isEmpty()
Checks if the list is empty.Checks if the list is not empty.Methods inherited from class org.assertj.core.api.AbstractAssert
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError
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, as, as, describedAs
-
Constructor Details
-
FluentListAssert
-
-
Method Details
-
isEmpty
Description copied from interface:ListStateAssert
Checks if the list is empty.Example:
assertThat(elementList).isEmpty();
- Specified by:
isEmpty
in interfaceListStateAssert
- Returns:
- this assertion object
-
isNotEmpty
Description copied from interface:ListStateAssert
Checks if the list is not empty.Example:
assertThat(elementList).isNotEmpty();
- Specified by:
isNotEmpty
in interfaceListStateAssert
- Returns:
- this assertion object
-
hasSize
Description copied from interface:ListStateAssert
Checks whether the list size is the same as the expected one in the argument.Example:
assertThat(elementList).hasSize(5);
- Specified by:
hasSize
in interfaceListStateAssert
- Parameters:
expectedSize
- expected size- Returns:
- this assertion object
-
hasSize
Description copied from interface:ListStateAssert
Creates aFluentListSizeBuilder
object from which further size related assertion methods may be called.This method doesn't do any assertion, only creates the new object.
Example:
assertThat(elementList).hasSize().greaterThanOrEqualTo(5);
- Specified by:
hasSize
in interfaceListStateAssert
- Returns:
- a new ist size builder
-
hasText
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, contain the text.Example:
For a
FluentWebElement
it can be:assertThat(element).hasText("magnificent");
which passes when the element contains (but is not necessarily exactly equal to) the argument text.NOTE: currently both this method and
FluentAssert.hasTextContaining(String)
validate text containment. If you want to validate containment please useFluentAssert.hasTextContaining(String)
, as this method will be updated in a future release to validate equality of text(s).- Specified by:
hasText
in interfaceFluentAssert
- Parameters:
textToFind
- text to find- Returns:
this
assertion object.
-
hasTextContaining
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, contain the text.Example:
For a
FluentWebElement
it can be:assertThat(element).hasTextContaining("magnificent");
which passes when the element contains (but is not necessarily exactly equal to) the argument text.NOTE: currently both
FluentAssert.hasText(String)
and this method validate text containment. If you want to validate containment please use this method, asFluentAssert.hasText(String)
will be updated in a future release to validate equality of text(s).- Specified by:
hasTextContaining
in interfaceFluentAssert
- Parameters:
textToFind
- text to find- Returns:
this
assertion object.
-
hasTextMatching
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, matches the given regex.Example:
For a
FluentWebElement
it can be:assertThat(element).hasTextMatching(".*magnificent$");
- Specified by:
hasTextMatching
in interfaceFluentAssert
- Parameters:
regexToBeMatched
- regex to be matched- Returns:
this
assertion object.
-
hasNotText
Description copied from interface:FluentAssert
Checks if the element does not contain, or none of the elements in a list of elements contain the text.Example:
For a
FluentWebElement
it can be:assertThat(element).hasNotText("magnificent");
which passes when the element text doesn't contains (and not when it is not equal to) to the argument text.NOTE: currently both this method and
FluentAssert.hasNotTextContaining(String)
validate text containment. If you want to validate containment please useFluentAssert.hasNotTextContaining(String)
, as this method will be updated in a future release to validate equality of text(s).- Specified by:
hasNotText
in interfaceFluentAssert
- Parameters:
textToFind
- text to find- Returns:
this
assertion object.
-
hasNotTextContaining
Description copied from interface:FluentAssert
Checks if the element does not contain, or none of the elements in a list of elements contain the text.Example:
For a
FluentWebElement
it can be:assertThat(element).hasNotText("magnificent");
which passes when the element text doesn't contains (and not when it is not equal to) to the argument text.NOTE: currently both
FluentAssert.hasNotText(String)
and this method validate text containment. If you want to validate containment please use this method, asFluentAssert.hasNotText(String)
will be updated in a future release to validate equality of text(s).- Specified by:
hasNotTextContaining
in interfaceFluentAssert
- Parameters:
textToFind
- text to find- Returns:
this
assertion object.
-
hasId
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has the given idExample:
For a
FluentWebElement
it can be:assertThat(element).hasId("marked");
which passes when the element text is equal to the argumentidToFind
.- Specified by:
hasId
in interfaceFluentAssert
- Parameters:
idToFind
- id to find- Returns:
this
assertion object.
-
hasClass
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has the class.Example:
For a
FluentWebElement
it can be:assertThat(element).hasClass("marked");
which passes when the element class attribute (handled as a list of class values) contains the argumentclassToFind
.- Specified by:
hasClass
in interfaceFluentAssert
- Parameters:
classToFind
- class to find- Returns:
this
assertion object.
-
hasClasses
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has all of the argument classes.Example:
For a
FluentWebElement
it can be:assertThat(element).hasClasses("marked", "as", "great");
which passes when the element class attribute (handled as a list of class values) contains all of the argumentclassesToFind
.- Specified by:
hasClasses
in interfaceFluentAssert
- Parameters:
classesToFind
- classes to find- Returns:
this
assertion object.
-
hasNotClass
Description copied from interface:FluentAssert
Checks if the element does not contain, or none of the elements in a list of elements contain the classIt passes assertion both when the class attribute is present but doesn't contain the argument class, and when the class attribute is not present at all.
Example:
For a
FluentWebElement
it can be:assertThat(element).hasNotClass("marked");
- Specified by:
hasNotClass
in interfaceFluentAssert
- Parameters:
htmlClass
- class to find the absence of- Returns:
this
assertion object.
-
hasNotClasses
Description copied from interface:FluentAssert
Checks if the element does not contain, or none of the elements in a list of elements contain any of the classes.Example:
For a
FluentWebElement
it can be:assertThat(element).hasNotClasses("marked", "as", "great");
- Specified by:
hasNotClasses
in interfaceFluentAssert
- Parameters:
htmlClasses
- classes to find the absence of- Returns:
this
assertion object.
-
hasValue
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements has given value (in its 'value' attribute).Example:
For a
FluentWebElement
it can be:assertThat(element).hasValue("John Smith");
which passes when the element's value is equal to the argument value.- Specified by:
hasValue
in interfaceFluentAssert
- Parameters:
value
- value to find- Returns:
this
assertion object.
-
hasName
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has given name (in its 'name' attribute).Example:
For a
FluentWebElement
it can be:assertThat(element).hasName("John Smith");
which passes when the element's value is equal to the argument name.- Specified by:
hasName
in interfaceFluentAssert
- Parameters:
name
- name to find- Returns:
this
assertion object.
-
hasTagName
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has given tag.Example:
For a
FluentWebElement
it can be:assertThat(element).hasTagName("div");
which passes when the element's value is equal to the argument tag name.- Specified by:
hasTagName
in interfaceFluentAssert
- Parameters:
tagName
- tag name to find- Returns:
this
assertion object.
-
hasDimension
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has given dimension.Example:
For a
FluentWebElement
it can be:assertThat(element).hasDimension(fluentWebElement.getDimension());
which passes when the element's dimension is equal to the argument dimension.- Specified by:
hasDimension
in interfaceFluentAssert
- Parameters:
dimension
- dimension to find- Returns:
this
assertion object.
-
hasAttributeValue
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has property with the exact given value.Example:
For a
FluentWebElement
it can be:assertThat(element).hasAttributeValue("href", "https://fluentlenium.io");
- Specified by:
hasAttributeValue
in interfaceFluentAssert
- Parameters:
attribute
- attribute to findvalue
- property value to match with actual- Returns:
this
assertion object.
-
hasAttribute
Description copied from interface:ListAttributeAssert
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 interfaceAttributeAssert<org.assertj.core.api.ListAssert<String>>
- Specified by:
hasAttribute
in interfaceListAttributeAssert
- Parameters:
attribute
- the attribute to find- Returns:
- a new
ListAssert
object with the actual attribute values
-
hasNotAttribute
Description copied from interface:AttributeAssert
Checks if the element doesn't have, or no element in a list of elements has, the given property.- Specified by:
hasNotAttribute
in interfaceAttributeAssert<org.assertj.core.api.ListAssert<String>>
- Parameters:
attribute
- attribute to find the absence of- Returns:
this
assertion object.
-