Top Description Fields Constructors Methods
org.assertj.core.api

public Class FactoryBasedNavigableIterableAssert<SELF extends FactoryBasedNavigableIterableAssert<SELF, ACTUAL, ELEMENT, ELEMENT_ASSERT>, ACTUAL extends Iterable<? extends ELEMENT>, ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>>

extends AbstractIterableAssert<SELF extends FactoryBasedNavigableIterableAssert<SELF, ACTUAL, ELEMENT, ELEMENT_ASSERT>, ACTUAL extends Iterable<? extends ELEMENT>, ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>>
Class Inheritance
Known Direct Subclasses
org.assertj.core.api.IterableAssert

Provides helper methods for navigating a list property in a generated assertion class so we can chain assertions through deeply nested models more easily.
Since
2.5.0 / 3.5.0

Field Summary

Modifier and TypeField and Description
private AssertFactory<ELEMENT, ELEMENT_ASSERT>
Inherited from org.assertj.core.api.AbstractIterableAssert:
iterables

Constructor Summary

AccessConstructor and Description
public
FactoryBasedNavigableIterableAssert(ACTUAL actual, Class<?> selfType, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory)

Method Summary

Modifier and TypeMethod and Description
public static <ACTUAL extends Iterable<? extends ELEMENT>, ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>> FactoryBasedNavigableIterableAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT>
assertThat(Iterable<? extends ELEMENT> actual, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory)

Deprecated This was added to help creating type-specific assertions for the elements of an Iterable instance.
protected SELF
newAbstractIterableAssert(Iterable<? extends ELEMENT>
the iterable used to build the concrete instance of AbstractIterableAssert
iterable
)

Implements abstract org.assertj.core.api.AbstractIterableAssert.newAbstractIterableAssert.

This methods is needed to build a new concrete instance of AbstractIterableAssert after a filtering operation is executed.
public ELEMENT_ASSERT
toAssert(ELEMENT
the element value
value
,
String
describes the element, ex: "check first element" for first(), used in assertion description.
description
)

Implements abstract org.assertj.core.api.AbstractIterableAssert.toAssert.

This method is used in navigating assertions like first(), last() and element(int) to build the assertion for the given element navigated to.
Inherited from org.assertj.core.api.AbstractIterableAssert:
allMatchallMatchallSatisfyallSatisfyanyMatchanySatisfyanySatisfyareareAtLeastareAtLeastOneareAtMostareExactlyareNotasascontainscontainsAllcontainsAnyElementsOfcontainsAnyOfcontainsAnyOfForProxycontainsExactlycontainsExactlyElementsOfcontainsExactlyForProxycontainsExactlyInAnyOrdercontainsExactlyInAnyOrderElementsOfcontainsExactlyInAnyOrderForProxycontainsForProxycontainsNullcontainsOnlycontainsOnlyElementsOfcontainsOnlyForProxycontainsOnlyNullscontainsOnlyOncecontainsOnlyOnceElementsOfcontainsOnlyOnceForProxycontainsSequencecontainsSequencecontainsSequenceForProxycontainsSubsequencecontainsSubsequencecontainsSubsequenceForProxydescribedAsdescribedAsdoesNotContaindoesNotContainAnyElementsOfdoesNotContainForProxydoesNotContainNulldoesNotContainSequencedoesNotContainSequencedoesNotContainSequenceForProxydoesNotContainSubsequencedoesNotContainSubsequencedoesNotContainSubsequenceForProxydoesNotHavedoesNotHaveAnyElementsOfTypesdoesNotHaveDuplicatesdoesNotHaveSameClassAsdoNotHaveelementelementelementsendsWithendsWithendsWithForProxyextractingextractingextractingextractingextractingextractingextractingForProxyextractingResultOfextractingResultOffilteredOnfilteredOnfilteredOnfilteredOnfilteredOnfilteredOnAssertionsfilteredOnAssertionsfilteredOnNullfirstfirstflatExtractingflatExtractingflatExtractingflatExtractingflatExtractingflatExtractingflatExtractingForProxyflatMapflatMapflatMapflatMapgetComparatorsByTypegetComparatorsForElementPropertyOrFieldTypeshashasAtLeastOneElementOfTypehasExactlyElementsOfTypeshasOnlyElementsOfTypehasOnlyElementsOfTypeshasOnlyOneElementSatisfyinghasSameClassAshasSameElementsAshasSameSizeAshasSameSizeAshasSizehasSizeBetweenhasSizeGreaterThanhasSizeGreaterThanOrEqualTohasSizeLessThanhasSizeLessThanOrEqualTohasToStringhavehaveAtLeasthaveAtLeastOnehaveAtMosthaveExactlyinBinaryinHexadecimalisisEmptyisEqualToisExactlyInstanceOfisInisInisInstanceOfisInstanceOfAnyisNotisNotEmptyisNotEqualToisNotExactlyInstanceOfisNotInisNotInisNotInstanceOfisNotInstanceOfAnyisNotNullisNotOfAnyClassInisNotSameAsisNullOrEmptyisOfAnyClassInisSameAsisSubsetOfisSubsetOfisSubsetOfForProxylastlastmapmapmapnavigationDescriptionnewAbstractIterableAssertForProxynoneMatchnoneSatisfynoneSatisfyoverridingErrorMessagesatisfiesExactlysatisfiesExactlysatisfiesExactlyForProxysatisfiesExactlyInAnyOrdersatisfiesExactlyInAnyOrdersatisfiesExactlyInAnyOrderForProxysatisfiesOnlyOncesatisfiesOnlyOncesatisfiesOnlyOnceForProxysingleElementsingleElementsizestartsWithstartsWithForProxyusingComparatorusingComparatorusingComparatorForElementFieldsWithNamesusingComparatorForElementFieldsWithTypeusingComparatorForTypeusingComparisonStrategyusingDefaultComparatorusingDefaultElementComparatorusingElementComparatorusingElementComparatorIgnoringFieldsusingElementComparatorOnFieldsusingFieldByFieldElementComparatorusingRecursiveAssertionusingRecursiveAssertionusingRecursiveComparisonusingRecursiveComparisonusingRecursiveFieldByFieldElementComparatorusingRecursiveFieldByFieldElementComparatorusingRecursiveFieldByFieldElementComparatorIgnoringFieldsusingRecursiveFieldByFieldElementComparatorOnFieldswithAssertionStatewithComparatorsForElementPropertyOrFieldNameswithComparatorsForElementPropertyOrFieldTypeswithFailMessagewithIterableswithThreadDumpOnErrorwithTypeComparatorszipSatisfy

Field Detail

assertFactoryback to summary
private AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory

Constructor Detail

FactoryBasedNavigableIterableAssertback to summary
public FactoryBasedNavigableIterableAssert(ACTUAL actual, Class<?> selfType, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory)

Method Detail

assertThatback to summary
public static <ACTUAL extends Iterable<? extends ELEMENT>, ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>> FactoryBasedNavigableIterableAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT> assertThat(Iterable<? extends ELEMENT> actual, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory)

Deprecated

This was added to help creating type-specific assertions for the elements of an Iterable instance.

Deprecated way:

 Iterable<String> hobbits = Set.of("frodo", "sam", "Pippin");
assertThat(hobbits, StringAssert::new).first()
                                      .startsWith("fro")
                                      .endsWith("do");
However, there is a better way with InstanceOfAssertFactory and the corresponding first(InstanceOfAssertFactory).

New way:

 assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING
                   .startsWith("fro")
                   .endsWith("do");
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.
Annotations
@Deprecated
@SuppressWarnings:unchecked, rawtypes
newAbstractIterableAssertback to summary
protected SELF newAbstractIterableAssert(Iterable<? extends ELEMENT> iterable)

Implements abstract org.assertj.core.api.AbstractIterableAssert.newAbstractIterableAssert.

Doc from org.assertj.core.api.AbstractIterableAssert.newAbstractIterableAssert.

This methods is needed to build a new concrete instance of AbstractIterableAssert after a filtering operation is executed.

If you create your own subclass of AbstractIterableAssert, simply returns an instance of it in this method.

Parameters
iterable:Iterable<? extends ELEMENT>

the iterable used to build the concrete instance of AbstractIterableAssert

Returns:SELF

concrete instance of AbstractIterableAssert

Annotations
@SuppressWarnings:unchecked
@Override
toAssertback to summary
public ELEMENT_ASSERT toAssert(ELEMENT value, String description)

Implements abstract org.assertj.core.api.AbstractIterableAssert.toAssert.

Doc from org.assertj.core.api.AbstractIterableAssert.toAssert.

This method is used in navigating assertions like first(), last() and element(int) to build the assertion for the given element navigated to.

Typical implementation is returning an ObjectAssert but it is possible to return a more specialized assertions should you know what type of elements the iterables contain.

Parameters
value:ELEMENT

the element value

description:String

describes the element, ex: "check first element" for first(), used in assertion description.

Returns:ELEMENT_ASSERT

the assertion for the given element

Annotations
@Override