Top Description Methods
org.assertj.core.api

public Interface IndexedObjectEnumerableAssert<SELF extends IndexedObjectEnumerableAssert<SELF, ELEMENT>, ELEMENT>

extends ObjectEnumerableAssert<SELF extends IndexedObjectEnumerableAssert<SELF, ELEMENT>, ELEMENT>
Known Direct Implementers
org.assertj.core.api.AbstractObjectArrayAssert, org.assertj.core.api.AbstractListAssert, org.assertj.core.api.AtomicReferenceArrayAssert
Type Parameters
<SELF>
the "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation" for more details.
<ELEMENT>
the type of elements of the "actual" value.
Imports
org.assertj.core.data.Index

Assertions methods applicable to indexed groups of objects (e.g. arrays or lists.)
Authors
Alex Ruiz, Mikhail Mazursky

Method Summary

Modifier and TypeMethod and Description
public SELF

Returns:

this assertion object.
contains
(ELEMENT
the object to look for.
value
,
Index
the index where the object should be stored in the actual group.
index
)

Verifies that the actual group contains the given object at the given index.

public SELF

Returns:

this assertion object.
doesNotContain
(ELEMENT
the object to look for.
value
,
Index
the index where the object should not be stored in the actual group.
index
)

Verifies that the actual group does not contain the given object at the given index.

Inherited from org.assertj.core.api.ObjectEnumerableAssert:
allMatchallMatchallSatisfyallSatisfyanyMatchanySatisfyanySatisfyareareAtLeastareAtLeastOneareAtMostareExactlyareNotcontainscontainsAllcontainsAnyElementsOfcontainsAnyOfcontainsExactlycontainsExactlyElementsOfcontainsExactlyInAnyOrdercontainsExactlyInAnyOrderElementsOfcontainsNullcontainsOnlycontainsOnlyElementsOfcontainsOnlyNullscontainsOnlyOncecontainsOnlyOnceElementsOfcontainsSequencecontainsSequencecontainsSubsequencecontainsSubsequencedoesNotContaindoesNotContainAnyElementsOfdoesNotContainNulldoesNotContainSequencedoesNotContainSequencedoesNotContainSubsequencedoesNotContainSubsequencedoesNotHaveAnyElementsOfTypesdoesNotHaveDuplicatesdoNotHaveendsWithendsWithhasAtLeastOneElementOfTypehasExactlyElementsOfTypeshasOnlyElementsOfTypehasOnlyElementsOfTypeshasOnlyOneElementSatisfyinghasSameElementsAshavehaveAtLeasthaveAtLeastOnehaveAtMosthaveExactlyisSubsetOfisSubsetOfnoneMatchnoneSatisfynoneSatisfysatisfiesExactlysatisfiesExactlysatisfiesExactlyInAnyOrdersatisfiesExactlyInAnyOrdersatisfiesOnlyOncesatisfiesOnlyOncestartsWith

Method Detail

containsback to summary
public SELF contains(ELEMENT value, Index index)

Verifies that the actual group contains the given object at the given index.

Example:

 List<Ring> elvesRings = newArrayList(vilya, nenya, narya);

// assertions will pass
assertThat(elvesRings).contains(vilya, atIndex(0));
assertThat(elvesRings).contains(nenya, atIndex(1));
assertThat(elvesRings).contains(narya, atIndex(2));

// assertions will fail
assertThat(elvesRings).contains(vilya, atIndex(1));
assertThat(elvesRings).contains(nenya, atIndex(2));
assertThat(elvesRings).contains(narya, atIndex(0));
Parameters
value:ELEMENT

the object to look for.

index:Index

the index where the object should be stored in the actual group.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual group is null or empty.
  • if the actual group does not contain the given object at the given index.
NullPointerException:
if the given Index is null.
IndexOutOfBoundsException:
if the value of the given Index is equal to or greater than the size of the actual group.
doesNotContainback to summary
public SELF doesNotContain(ELEMENT value, Index index)

Verifies that the actual group does not contain the given object at the given index.

Example:

 List<Ring> elvesRings = newArrayList(vilya, nenya, narya);

// assertions will pass
assertThat(elvesRings).contains(vilya, atIndex(1));
assertThat(elvesRings).contains(nenya, atIndex(2));
assertThat(elvesRings).contains(narya, atIndex(0));

// assertions will fail
assertThat(elvesRings).contains(vilya, atIndex(0));
assertThat(elvesRings).contains(nenya, atIndex(1));
assertThat(elvesRings).contains(narya, atIndex(2));
Parameters
value:ELEMENT

the object to look for.

index:Index

the index where the object should not be stored in the actual group.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual group is null.
  • if the actual group contains the given object at the given index.
NullPointerException:
if the given Index is null.