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

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

extends AbstractIterableAssert<SELF extends ClassBasedNavigableIterableAssert<SELF, ACTUAL, ELEMENT, ELEMENT_ASSERT>, ACTUAL extends Iterable<? extends ELEMENT>, ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>>
Class Inheritance
Imports
java.lang.reflect.Constructor

Build the Assert instance by reflection.
Since
2.5.0 / 3.5.0

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
ClassBasedNavigableIterableAssert(ACTUAL actual, Class<?> selfType, Class<ELEMENT_ASSERT> assertClass)

Method Summary

Modifier and TypeMethod and Description
public static <ACTUAL extends Iterable<? extends ELEMENT>, ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>> ClassBasedNavigableIterableAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT>
assertThat(ACTUAL actual, Class<ELEMENT_ASSERT> assertClass)

Deprecated This was added to help creating type-specific assertions for the elements of an Iterable instance.
private <V> ELEMENT_ASSERT
buildAssert(V value, String description, Class<?> clazz)

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

assertClassback to summary
private Class<ELEMENT_ASSERT> assertClass

Constructor Detail

ClassBasedNavigableIterableAssertback to summary
public ClassBasedNavigableIterableAssert(ACTUAL actual, Class<?> selfType, Class<ELEMENT_ASSERT> assertClass)

Method Detail

assertThatback to summary
public static <ACTUAL extends Iterable<? extends ELEMENT>, ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>> ClassBasedNavigableIterableAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT> assertThat(ACTUAL actual, Class<ELEMENT_ASSERT> assertClass)

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.class).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:rawtypes, unchecked
buildAssertback to summary
private <V> ELEMENT_ASSERT buildAssert(V value, String description, Class<?> clazz)
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