Top Description Methods
org.assertj.core.api

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

extends EnumerableAssert<SELF extends ObjectEnumerableAssert<SELF, ELEMENT>, ELEMENT>
Known Direct Subinterfaces
org.assertj.core.api.IndexedObjectEnumerableAssert
Known Direct Implementers
org.assertj.core.api.AbstractIterableAssert
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
java.util.HashSet, java.util.function.Consumer, .Predicate

Assertions methods applicable to groups of objects (e.g. arrays or collections.)
Authors
Yvonne Wang, Alex Ruiz, Nicolas François, Mikhail Mazursky, Joel Costigliola, Florent Biville

Method Summary

Modifier and TypeMethod and Description
public SELF

Returns:

this object.
allMatch
(Predicate<? super ELEMENT>
the given Predicate.
predicate
)

Verifies that all the elements of actual match the given Predicate.

public SELF

Returns:

this object.
allMatch
(Predicate<? super ELEMENT>
the given Predicate.
predicate
,
String
a description of the Predicate used in the error message
predicateDescription
)

Verifies that all the elements of actual match the given Predicate.

public SELF

Returns:

this object.
allSatisfy
(Consumer<? super ELEMENT>
the given Consumer.
requirements
)

Verifies that all the elements satisfy the given requirements expressed as a Consumer.

public SELF

Returns:

this object.
allSatisfy
(ThrowingConsumer<? super ELEMENT>
the given ThrowingConsumer.
requirements
)

Verifies that all the elements satisfy the given requirements expressed as a ThrowingConsumer.

public SELF

Returns:

this object.
anyMatch
(Predicate<? super ELEMENT>
the given Predicate.
predicate
)

Verifies whether any elements match the provided Predicate.

public SELF

Returns:

this object.
anySatisfy
(Consumer<? super ELEMENT>
the given Consumer.
requirements
)

Verifies that at least one element satisfies the given requirements expressed as a Consumer.

public SELF

Returns:

this object.
anySatisfy
(ThrowingConsumer<? super ELEMENT>
the given ThrowingConsumer.
requirements
)

Verifies that at least one element satisfies the given requirements expressed as a ThrowingConsumer.

public SELF

Returns:

this object.
are
(Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that each element value satisfies the given condition.

public SELF

Returns:

this object.
areAtLeast
(int
the minimum number of times the condition should be verified.
n
,
Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that there are at least n elements in the actual group satisfying the given condition.

public SELF

Returns:

this assertion object.
areAtLeastOne
(Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that there is at least one element in the actual group satisfying the given condition.

public SELF

Returns:

this object.
areAtMost
(int
the number of times the condition should be at most verified.
n
,
Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that there are at most n elements in the actual group satisfying the given condition.

public SELF

Returns:

this object.
areExactly
(int
the exact number of times the condition should be verified.
n
,
Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that there are exactly n elements in the actual group satisfying the given condition.

public SELF

Returns:

this object.
areNot
(Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that each element value does not satisfy the given condition.

public SELF

Returns:

this assertion object.
contains
(ELEMENT...
the given values.
values
)

Verifies that the actual group contains the given values, in any order.

public SELF

Returns:

this assertion object.
containsAll
(Iterable<? extends ELEMENT>
the given Iterable we will get elements from.
iterable
)

Verifies that the actual group contains all the elements of given Iterable, in any order.

public SELF

Returns:

this assertion object.
containsAnyElementsOf
(Iterable<? extends ELEMENT>
the iterable whose at least one element is expected to be in the Iterable under test.
iterable
)

Verifies that the Iterable under test contains at least one of the given Iterable elements.

public SELF

Returns:

this assertion object.
containsAnyOf
(ELEMENT...
the values whose at least one which is expected to be in the Iterable under test.
values
)

Verifies that the actual Iterable contains at least one of the given values.

public SELF

Returns:

this assertion object.
containsExactly
(ELEMENT...
the given values.
values
)

Verifies that the actual group contains exactly the given values and nothing else, in order.

public SELF

Returns:

this assertion object.
containsExactlyElementsOf
(Iterable<? extends ELEMENT>
the given Iterable we will get elements from.
iterable
)

Same as containsExactly(Object...) but handle the Iterable to array conversion : verifies that actual contains exactly the elements of the given iterable and nothing else in the same order.

public SELF

Returns:

this assertion object.
containsExactlyInAnyOrder
(ELEMENT...
the given values.
values
)

Verifies that the actual group contains exactly the given values and nothing else, in any order.

public SELF

Returns:

this assertion object.
containsExactlyInAnyOrderElementsOf
(Iterable<? extends ELEMENT>
the given values.
values
)

Verifies that the actual group contains exactly the given values and nothing else, in any order.

public SELF

Returns:

this assertion object.
containsNull
()

Verifies that the actual group contains at least a null element.

public SELF

Returns:

this assertion object.
containsOnly
(ELEMENT...
the given values.
values
)

Verifies that the actual group contains only the given values and nothing else, in any order and ignoring duplicates (i.e. once a value is found, its duplicates are also considered found).

public SELF

Returns:

this assertion object.
containsOnlyElementsOf
(Iterable<? extends ELEMENT>
the given Iterable we will get elements from.
iterable
)

Deprecated
Same semantic as containsOnly(Object[]) : verifies that actual contains all the elements of the given iterable and nothing else, in any order and ignoring duplicates (i.e. once a value is found, its duplicates are also considered found).
public SELF

Returns:

this assertion object.
containsOnlyNulls
()

Verifies that the actual group contains only null elements and nothing else.

public SELF

Returns:

this assertion object.
containsOnlyOnce
(ELEMENT...
the given values.
values
)

Verifies that the actual group contains the given values only once.

public SELF

Returns:

this assertion object.
containsOnlyOnceElementsOf
(Iterable<? extends ELEMENT>
the given Iterable we will get elements from.
iterable
)

Same semantic as containsOnlyOnce(Object...) : verifies that the actual group contains the elements of the given iterable only once.

public SELF

Returns:

this assertion object.
containsSequence
(ELEMENT...
the sequence of objects to look for.
sequence
)

Verifies that the actual group contains the given sequence in the correct order and without extra values between the sequence values.

public SELF

Returns:

this assertion object.
containsSequence
(Iterable<? extends ELEMENT>
the sequence of objects to look for.
sequence
)

Verifies that the actual group contains the given sequence in the correct order and without extra values between the sequence values.

public SELF

Returns:

this assertion object.
containsSubsequence
(ELEMENT...
the sequence of objects to look for.
sequence
)

Verifies that the actual group contains the given subsequence in the correct order (possibly with other values between them).

public SELF

Returns:

this assertion object.
containsSubsequence
(Iterable<? extends ELEMENT>
the sequence of objects to look for.
sequence
)

Verifies that the actual group contains the given subsequence in the correct order (possibly with other values between them).

public SELF

Returns:

this assertion object.
doesNotContain
(ELEMENT...
the given values.
values
)

Verifies that the actual group does not contain the given values.

public SELF

Returns:

this assertion object.
doesNotContainAnyElementsOf
(Iterable<? extends ELEMENT>
the Iterable whose elements must not be in the actual group.
iterable
)

Verifies that actual does not contain any elements of the given Iterable (i.e. none).

public SELF

Returns:

this assertion object.
doesNotContainNull
()

Verifies that the actual group does not contain null elements.

public SELF

Returns:

this assertion object.
doesNotContainSequence
(ELEMENT...
the sequence of objects to look for.
sequence
)

Verifies that the actual group does not contain the given sequence, a sequence is defined by an ordered group of values without extra values between them.

public SELF

Returns:

this assertion object.
doesNotContainSequence
(Iterable<? extends ELEMENT>
the sequence of objects to look for.
sequence
)

Verifies that the actual group does not contain the given sequence, a sequence is defined by an ordered group of values without extra values between them.

public SELF

Returns:

this assertion object.
doesNotContainSubsequence
(ELEMENT...
the sequence of objects to look for.
sequence
)

Verifies that the actual group does not contain the given subsequence, a subsequence is defined by an ordered group of values with possibly extra values between them.

public SELF

Returns:

this assertion object.
doesNotContainSubsequence
(Iterable<? extends ELEMENT>
the sequence of objects to look for.
sequence
)

Verifies that the actual group does not contain the given subsequence, a subsequence is defined by an ordered group of values with possibly extra values between them.

public SELF

Returns:

this assertion object.
doesNotHaveAnyElementsOfTypes
(Class<?>...
the not expected types.
unexpectedTypes
)

Verifies that all the elements in the actual Object group do not belong to the specified types (including subclasses).

public SELF

Returns:

this assertion object.
doesNotHaveDuplicates
()

Verifies that the actual group does not contain duplicates.

public SELF

Returns:

this object.
doNotHave
(Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that all elements do not satisfy the given condition.

public SELF

Returns:

this assertion object.
endsWith
(ELEMENT
the first element of the sequence of objects to look for.
first
,
ELEMENT...
the rest of the sequence of objects to look for.
sequence
)

Verifies that the actual group ends with the given sequence of objects, without any other objects between them.

public SELF

Returns:

this assertion object.
endsWith
(ELEMENT[]
the sequence of objects to look for.
sequence
)

Verifies that the actual group ends with the given sequence of objects, without any other objects between them.

public SELF

Returns:

this assertion object.
hasAtLeastOneElementOfType
(Class<?>
the expected type.
expectedType
)

Verifies that at least one element in the actual Object group has the specified type (matching includes subclasses of the given type).

public SELF

Returns:

this assertion object.
hasExactlyElementsOfTypes
(Class<?>...
the expected types
expectedTypes
)

Verifies that the actual elements are of the given types in the given order, there should be as many expected types as there are actual elements.

public SELF

Returns:

this assertion object.
hasOnlyElementsOfType
(Class<?>
the expected type.
expectedType
)

Verifies that all the elements in the actual Object group belong to the specified type (matching includes subclasses of the given type).

public SELF

Returns:

this assertion object.
hasOnlyElementsOfTypes
(Class<?>...
the expected types
expectedTypes
)

Verifies that all elements of the actual group are instances of the given types.

public SELF

Returns:

this assertion object.
hasOnlyOneElementSatisfying
(Consumer<? super ELEMENT>
the assertions to perform on the unique element.
elementAssertions
)

Verifies that the unique element of the Iterable satisfies the given assertions expressed as a Consumer, if it does not, only the first error is reported, use SoftAssertions to get all the errors.

public SELF

Returns:

this assertion object
hasSameElementsAs
(Iterable<? extends ELEMENT>
the Iterable whose elements we expect to be present
iterable
)

Verifies that actual contains all the elements of the given iterable and nothing else, in any order and ignoring duplicates (i.e. once a value is found, its duplicates are also considered found).

public SELF

Returns:

this object.
have
(Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that all elements satisfy the given condition.

public SELF

Returns:

this assertion object.
haveAtLeast
(int
the minimum number of times the condition must hold.
n
,
Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that there are at least n elements in the actual group satisfying the given condition.

public SELF

Returns:

this assertion object.
haveAtLeastOne
(Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that there is at least one element in the actual group satisfying the given condition.

public SELF

Returns:

this assertion object.
haveAtMost
(int
the maximum number of times the condition must hold.
n
,
Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that there are at most n elements in the actual group satisfying the given condition.

public SELF

Returns:

this assertion object.
haveExactly
(int
the exact number of times the condition must hold.
n
,
Condition<? super ELEMENT>
the given condition.
condition
)

Verifies that there are exactly n elements in the actual group satisfying the given condition.

public SELF

Returns:

this assertion object.
isSubsetOf
(Iterable<? extends ELEMENT>
the Iterable that should contain all actual elements.
values
)

Verifies that all the elements of actual are present in the given Iterable.

public SELF

Returns:

this assertion object.
isSubsetOf
(ELEMENT...
the values that should be used for checking the elements of actual.
values
)

Verifies that all the elements of actual are present in the given values.

public SELF

Returns:

this object.
noneMatch
(Predicate<? super ELEMENT>
the given Predicate.
predicate
)

Verifies that no elements match the given Predicate.

public SELF

Returns:

this object.
noneSatisfy
(Consumer<? super ELEMENT>
the given restrictions as Consumer that no elements should met.
restrictions
)

Verifies that no elements satisfy the given restrictions expressed as a Consumer.

public SELF

Returns:

this object.
noneSatisfy
(ThrowingConsumer<? super ELEMENT>
the given ThrowingConsumer.
restrictions
)

Verifies that no elements satisfy the given restrictions expressed as a Consumer.

public SELF

Returns:

this to chain assertions.
satisfiesExactly
(Consumer<? super ELEMENT>...
the requirements to meet.
allRequirements
)

Verifies that each element satisfies the requirements corresponding to its index, so the first element must satisfy the first requirements, the second element the second requirements etc...

public SELF

Returns:

this to chain assertions.
satisfiesExactly
(ThrowingConsumer<? super ELEMENT>...
the requirements to meet.
allRequirements
)

Verifies that each element satisfies the requirements corresponding to its index, so the first element must satisfy the first requirements, the second element the second requirements etc...

public SELF

Returns:

this assertion object.
satisfiesExactlyInAnyOrder
(Consumer<? super ELEMENT>...
the consumers that are expected to be satisfied by the elements of the given Iterable.
allRequirements
)

Verifies that at least one combination of iterable elements exists that satisfies the consumers in order (there must be as many consumers as iterable elements and once a consumer is matched it cannot be reused to match other elements).

public SELF

Returns:

this assertion object.
satisfiesExactlyInAnyOrder
(ThrowingConsumer<? super ELEMENT>...
the consumers that are expected to be satisfied by the elements of the given Iterable.
allRequirements
)

Verifies that at least one combination of iterable elements exists that satisfies the ThrowingConsumers in order (there must be as many consumers as iterable elements and once a consumer is matched it cannot be reused to match other elements).

public SELF

Returns:

this assertion object.
satisfiesOnlyOnce
(Consumer<? super ELEMENT>
the Consumer that is expected to be satisfied only once by the elements of the given Iterable.
requirements
)

Verifies that there is exactly one element in the iterable under tests that satisfies the Consumer.

public SELF

Returns:

this assertion object.
satisfiesOnlyOnce
(ThrowingConsumer<? super ELEMENT>
the ThrowingConsumer that is expected to be satisfied only once by the elements of the given Iterable.
requirements
)

Verifies that there is exactly one element in the iterable under tests that satisfies the ThrowingConsumer.

public SELF

Returns:

this assertion object.
startsWith
(ELEMENT...
the sequence of objects to look for.
sequence
)

Verifies that the actual group starts with the given sequence of objects, without any other objects between them.

Inherited from org.assertj.core.api.EnumerableAssert:
hasSameSizeAshasSameSizeAshasSizehasSizeBetweenhasSizeGreaterThanhasSizeGreaterThanOrEqualTohasSizeLessThanhasSizeLessThanOrEqualToisEmptyisNotEmptyisNullOrEmptyusingDefaultElementComparatorusingElementComparator