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

public abstract Class AbstractObjectArrayAssert<SELF extends AbstractObjectArrayAssert<SELF, ELEMENT>, ELEMENT>

extends AbstractAssert<SELF extends AbstractObjectArrayAssert<SELF, ELEMENT>, ELEMENT[]>
implements IndexedObjectEnumerableAssert<AbstractObjectArrayAssert<SELF extends AbstractObjectArrayAssert<SELF, ELEMENT>, ELEMENT>, ELEMENT>, ArraySortedAssert<AbstractObjectArrayAssert<SELF extends AbstractObjectArrayAssert<SELF, ELEMENT>, ELEMENT>, ELEMENT>
Class Inheritance
All Implemented Interfaces
org.assertj.core.api.ArraySortedAssert, org.assertj.core.api.IndexedObjectEnumerableAssert, org.assertj.core.api.ObjectEnumerableAssert, org.assertj.core.api.EnumerableAssert
Known Direct Subclasses
org.assertj.core.api.ObjectArrayAssert
Annotations
@SuppressWarnings:deprecation, RedundantSuppression
Type Parameters
<ELEMENT>
the type of elements of the "actual" value.
Static Imports
java.util.Arrays.copyOf, .Arrays.stream, java.util.stream.Collectors.toList, org.assertj.core.api.filter.Filters.filter, org.assertj.core.description.Description.mostRelevantDescription, org.assertj.core.extractor.Extractors.byName, .Extractors.extractedDescriptionOf, .Extractors.extractedDescriptionOfMethod, .Extractors.resultOf, org.assertj.core.internal.CommonValidations.checkSequenceIsNotNull, .CommonValidations.checkSubsequenceIsNotNull, .Iterables.byPassingAssertions, .TypeComparators.defaultTypeComparators, org.assertj.core.util.Arrays.isArray, .IterableUtil.toArray, .Lists.newArrayList, .Preconditions.checkArgument, .Preconditions.checkNotNull

Assertion methods for arrays of objects.

To create an instance of this class, invoke Assertions#assertThat(Object[]).

Authors
Yvonne Wang, Alex Ruiz, Joel Costigliola, Nicolas François, Mikhail Mazursky, Mateusz Haligowski, Lovro Pandzic

Field Summary

Modifier and TypeField and Description
pack-priv ObjectArrays
private static final String
pack-priv TypeComparators
pack-priv Map<String, Comparator<?>>
pack-priv TypeComparators
pack-priv Iterables
Inherited from org.assertj.core.api.AbstractAssert:
actualassertionErrorCreatorconditionscustomRepresentationinfomyselfobjectsprintAssertionsDescriptionthrowUnsupportedExceptionOnEquals

Constructor Summary

AccessConstructor and Description
protected
AbstractObjectArrayAssert(ELEMENT[] actual, Class<?> selfType)

Method Summary

Modifier and TypeMethod and Description
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.allMatch.

Verifies that all elements match the given Predicate.
public SELF
allMatch(Predicate<? super ELEMENT>
the given Predicate.
predicate
,
String
a description of the Predicate used in the error message
predicateDescription
)

Implements org.assertj.core.api.ObjectEnumerableAssert.allMatch.

Verifies that all the elements of actual match the given Predicate.
public SELF
allSatisfy(Consumer<? super ELEMENT>
the given Consumer.
requirements
)

Implements org.assertj.core.api.ObjectEnumerableAssert.allSatisfy.

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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.allSatisfy.

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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.anyMatch.

Verifies whether any elements match the provided Predicate.
public SELF
anySatisfy(Consumer<? super ELEMENT>
the given Consumer.
requirements
)

Implements org.assertj.core.api.ObjectEnumerableAssert.anySatisfy.

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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.anySatisfy.

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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.are.

Verifies that each element value satisfies the given condition

Example :

 String[] abc  = {"a", "b", "c"};
String[] abcc = {"a", "b", "cc"};

Condition<String> singleCharacterString
     = new Condition<>(s -> s.length() == 1, "single character String");

// assertion will pass
assertThat(abc).are(singleCharacterString);

// assertion will fail
assertThat(abcc).are(singleCharacterString);
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.areAtLeast.

Verifies that there are at least n elements in the actual array satisfying the given condition.
public SELF
areAtLeastOne(Condition<? super ELEMENT>
the given condition.
condition
)

Implements org.assertj.core.api.ObjectEnumerableAssert.areAtLeastOne.

Verifies that there is at least one element in the actual array satisfying the given condition.
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.areAtMost.

Verifies that there are at most n elements in the actual array satisfying the given condition.
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.areExactly.

Verifies that there are exactly n elements in the actual array satisfying the given condition.
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.areNot.

Verifies that each element value does not satisfy the given condition

Example :

 String[] abc  = {"a", "b", "c"};
String[] abcc = {"a", "b", "cc"};

Condition<String> moreThanOneCharacter =
    = new Condition<>(s -> s.length() > 1, "more than one character");

// assertion will pass
assertThat(abc).areNot(moreThanOneCharacter);

// assertion will fail
assertThat(abcc).areNot(moreThanOneCharacter);
public SELF
as(Description
the new description to set.
description
)

Overrides default org.assertj.core.api.Descriptable.as.

Sets the description of the assertion that is going to be called after.
public SELF
as(String
the new description to set.
description
,
Object...
optional parameter if description is a format String.
args
)

Overrides default org.assertj.core.api.Descriptable.as.

Sets the description of the assertion that is going to be called after.
public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.contains.

Verifies that the actual array contains the given values, in any order.
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 array.
index
)

Implements org.assertj.core.api.IndexedObjectEnumerableAssert.contains.

Verifies that the actual array contains the given object at the given index.
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.containsAll.

Verifies that the actual array 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 array under test.
iterable
)

Implements org.assertj.core.api.ObjectEnumerableAssert.containsAnyElementsOf.

Verifies that the actual array contains at least one of the given Iterable elements.
public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.containsAnyOf.

Verifies that the actual array contains at least one of the given values.
protected SELF
containsAnyOfForProxy(ELEMENT[] values)

public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.containsExactly.

Verifies that the actual array contains exactly the given values and nothing else, in order.
public SELF
containsExactlyElementsOf(Iterable<? extends ELEMENT>
the given Iterable we will get elements from.
iterable
)

Implements org.assertj.core.api.ObjectEnumerableAssert.containsExactlyElementsOf.

Same as containsExactly(Object...) but handles the Iterable to array conversion : verifies that actual contains exactly the elements of the given Iterable and nothing else in the same order.
protected SELF
containsExactlyForProxy(ELEMENT[] values)

public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.containsExactlyInAnyOrder.

Verifies that the actual array contains exactly the given values and nothing else, in any order.
public SELF
containsExactlyInAnyOrderElementsOf(Iterable<? extends ELEMENT>
the given values.
values
)

Implements org.assertj.core.api.ObjectEnumerableAssert.containsExactlyInAnyOrderElementsOf.

Verifies that the actual group contains exactly the given values and nothing else, in any order.
protected SELF
protected SELF
containsForProxy(ELEMENT[] values)

public SELF

Returns:

this assertion object.
containsNull
()

Implements org.assertj.core.api.ObjectEnumerableAssert.containsNull.

Verifies that the actual array contains at least a null element.
public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.containsOnly.

Verifies that the actual array 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
containsOnlyElementsOf(Iterable<? extends ELEMENT>
the given Iterable we will get elements from.
iterable
)

Implements org.assertj.core.api.ObjectEnumerableAssert.containsOnlyElementsOf.

Same semantic as containsOnly(Object[]) : verifies that actual contains all 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).
protected SELF
containsOnlyForProxy(ELEMENT[] values)

public SELF

Returns:

this assertion object.
containsOnlyNulls
()

Implements org.assertj.core.api.ObjectEnumerableAssert.containsOnlyNulls.

Verifies that the actual array contains only null elements.
public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.containsOnlyOnce.

Verifies that the actual array contains the given values only once.
public SELF
containsOnlyOnceElementsOf(Iterable<? extends ELEMENT>
the given Iterable we will get elements from.
iterable
)

Implements org.assertj.core.api.ObjectEnumerableAssert.containsOnlyOnceElementsOf.

Same semantic as containsOnlyOnce(Object...) : verifies that the actual group contains the elements of the given iterable only once.
protected SELF
containsOnlyOnceForProxy(ELEMENT[] values)

public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.containsSequence.

Verifies that the actual array 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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.containsSequence.

Verifies that the actual array contains the given sequence in the correct order and without extra values between the sequence values.
protected SELF
containsSequenceForProxy(ELEMENT[] sequence)

public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.containsSubsequence.

Verifies that the actual array 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 subsequence of objects to look for.
subsequence
)

Implements org.assertj.core.api.ObjectEnumerableAssert.containsSubsequence.

Verifies that the actual array contains the given subsequence in the correct order (possibly with other values between them).
protected SELF
containsSubsequenceForProxy(ELEMENT[] subsequence)

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 array.
index
)

Implements org.assertj.core.api.IndexedObjectEnumerableAssert.doesNotContain.

Verifies that the actual array does not contain the given object at the given index.
public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.doesNotContain.

Verifies that the actual array 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 array.
iterable
)

Implements org.assertj.core.api.ObjectEnumerableAssert.doesNotContainAnyElementsOf.

Verifies that the actual array does not contain any elements of the given Iterable (i.e. none).
protected SELF
doesNotContainForProxy(ELEMENT[] values)

public SELF

Returns:

this assertion object.
doesNotContainNull
()

Implements org.assertj.core.api.ObjectEnumerableAssert.doesNotContainNull.

Verifies that the actual array does not contain null elements.
public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.doesNotContainSequence.

Verifies that the actual array does not contain the given sequence in the given order and without extra values between the sequence values.
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.doesNotContainSequence.

Verifies that the actual array does not contain the given sequence in the given order and without extra values between the sequence values.
protected SELF
doesNotContainSequenceForProxy(ELEMENT[] sequence)

public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.doesNotContainSubsequence.

Verifies that the actual array does not contain the given subsequence in the correct order (possibly with other values between them).
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.doesNotContainSubsequence.

Verifies that the actual array does not contain the given subsequence in the correct order (possibly with other values between them).
protected SELF
doesNotContainSubsequenceForProxy(ELEMENT[] subsequence)

public SELF
doesNotHaveAnyElementsOfTypes(Class<?>...
the not expected types.
unexpectedTypes
)

Implements org.assertj.core.api.ObjectEnumerableAssert.doesNotHaveAnyElementsOfTypes.

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
()

Implements org.assertj.core.api.ObjectEnumerableAssert.doesNotHaveDuplicates.

Verifies that the actual array does not contain duplicates.
private <V, C extends Collection<V>> AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>>
doFlatExtracting(Function<? super ELEMENT, C> extractor)

public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.doNotHave.

Verifies that all elements don't satisfy the given condition.
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.endsWith.

Verifies that the actual array ends with the given sequence of objects, without any other objects between them.
public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.endsWith.

Verifies that the actual array ends with the given sequence of objects, without any other objects between them.
protected SELF
endsWithForProxy(ELEMENT first, ELEMENT[] sequence)

public AbstractListAssert<?, List<? extends Object>, Object, ObjectAssert<Object>>

Returns:

a new assertion object whose object under test is the list of extracted field/property values.
extracting
(String
the field/property to extract from the array under test
fieldOrProperty
)

Extract the values of given field or property from the array's elements under test into a new list, this new list becoming the object under test.

public <
the type of elements to extract.
P
>
AbstractListAssert<?, List<? extends P>, P, ObjectAssert<P>>

Returns:

a new assertion object whose object under test is the list of extracted field/property values.
extracting
(String
the field/property to extract from the array under test
fieldOrProperty
,
Class<P>
type to return
extractingType
)

Extract the values of given field or property from the array's elements under test into a new list, this new list of the provided type becoming the object under test.

public AbstractListAssert<?, List<? extends Tuple>, Tuple, ObjectAssert<Tuple>>

Returns:

a new assertion object whose object under test is the list of Tuple with extracted properties/fields values as data.
extracting
(String...
the properties/fields to extract from the initial array under test
propertiesOrFields
)

Extract the values of given fields/properties from the array's elements under test into a list composed of Tuple (a simple data structure), this new list becoming the object under test.

public <
the type of elements to extract.
U
>
AbstractListAssert<?, List<? extends U>, U, ObjectAssert<U>>

Returns:

a new assertion object whose object under test is the list of extracted values.
extracting
(Function<? super ELEMENT, U>
the object transforming input object to desired one
extractor
)

Extract the values from the array's elements by applying an extracting function on them, the resulting list becomes the new object under test.

public <
the type of elements to extract.
V
,
the exception type of ThrowingExtractor
EXCEPTION extends Exception
>
AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>>

Returns:

a new assertion object whose object under test is the list of extracted values
extracting
(ThrowingExtractor<? super ELEMENT, V, EXCEPTION>
the object transforming input object to desired one
extractor
)

Extract the values from the array's elements by applying an extracting function (which might throw an exception) on them, the resulting list of extracted values becomes a new object under test.

public final AbstractListAssert<?, List<? extends Tuple>, Tuple, ObjectAssert<Tuple>>

Returns:

a new assertion object whose object under test is the list of Tuples containing the extracted values.
extracting
(Function<? super ELEMENT, ?>...
the extractor functions to extract a value from an element of the array under test.
extractors
)

Use the given Functions to extract the values from the array's elements into a new list composed of Tuples (a simple data structure containing the extracted values), this new list becoming the object under test.

protected AbstractListAssert<?, List<? extends Tuple>, Tuple, ObjectAssert<Tuple>>
extractingForProxy(Function<? super ELEMENT, ?>[] extractors)

public AbstractListAssert<?, List<? extends Object>, Object, ObjectAssert<Object>>

Returns:

a new assertion object whose object under test is the list of extracted values.
extractingResultOf
(String
the name of the method which result is to be extracted from the array under test
method
)

Extract the result of given method invocation from the array's elements under test into a list, this list becoming the object under test.

public <
the type of elements extracted.
P
>
AbstractListAssert<?, List<? extends P>, P, ObjectAssert<P>>

Returns:

a new assertion object whose object under test is the list of extracted values.
extractingResultOf
(String
the name of the method which result is to be extracted from the array under test
method
,
Class<P>
type to return
extractingType
)

Extract the result of given method invocation from the array's elements under test into a list, this list becoming the object under test.

public SELF

Returns:

a new assertion object with the filtered list under test
filteredOn
(String
the name of the property or field to read
propertyOrFieldName
,
Object
the value to compare element's property or field with
expectedValue
)

Filter the array under test into a list composed of the elements elements having a property or field equal to expectedValue, the property/field is specified by propertyOrFieldName parameter.

public SELF

Returns:

a new assertion object with the filtered list under test
filteredOn
(String
the name of the property or field to read
propertyOrFieldName
,
FilterOperator<?>
the filter operator to apply
filterOperator
)

Filter the array under test into a list composed of elements having a property or field matching the filter expressed with the FilterOperator, the property/field is specified by propertyOrFieldName parameter.

public SELF

Returns:

a new assertion object with the filtered list under test
filteredOn
(Condition<? super ELEMENT>
the filter condition / predicate
condition
)

Filter the array under test into a list composed of the elements matching the given Condition, allowing to perform assertions on the filtered list.

public SELF

Returns:

a new assertion object with the filtered list under test
filteredOn
(Predicate<? super ELEMENT>
the filter predicate
predicate
)

Filter the array under test into a list composed of the elements matching the given Predicate, allowing to perform assertions on the filtered list.

public <
result type of the filter function
T
>
SELF

Returns:

a new assertion object with the filtered list under test
filteredOn
(Function<? super ELEMENT, T>
the filter function
function
,
T
the expected value of the filter function
expectedValue
)

Filter the array under test into a list composed of the elements for which the result of the function is equal to expectedValue.

public SELF

Returns:

a new assertion object with the filtered iterable under test
filteredOnAssertions
(Consumer<? super ELEMENT>
containing AssertJ assertions to filter on
elementAssertions
)

Filter the array under test keeping only elements matching the given assertions specified with a Consumer.

public SELF

Returns:

a new assertion object with the filtered iterable under test
filteredOnAssertions
(ThrowingConsumer<? super ELEMENT>
containing AssertJ assertions to filter on
elementAssertions
)

Filter the array under test keeping only elements matching the given assertions specified with a Consumer.

public SELF

Returns:

a new assertion object with the filtered list under test
filteredOnNull
(String
the name of the property or field to read
propertyOrFieldName
)

Filter the array under test into a list composed of the elements whose property or field specified by propertyOrFieldName are null.

public <
the type of elements to extract.
V
,
the type of collection to flat/extract.
C extends Collection<V>
>
AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>>

Returns:

a new assertion object whose object under test is the list of values extracted
flatExtracting
(Function<? super ELEMENT, C>
the object transforming input object to an Iterable of desired ones
extractor
)

Extract the Iterable values from arrays elements under test by applying an Iterable extracting function on them and concatenating the result lists into an array which becomes the new object under test.

public <
the type of elements to extract.
V
,
the type of collection to flat/extract.
C extends Collection<V>
,
the exception type of ThrowingExtractor
EXCEPTION extends Exception
>
AbstractListAssert<?, List<? extends V>, V, ObjectAssert<V>>

Returns:

a new assertion object whose object under test is the list of values extracted
flatExtracting
(ThrowingExtractor<? super ELEMENT, C, EXCEPTION>
the object transforming input object to an Iterable of desired ones
extractor
)

Extract the Iterable values from arrays elements under test by applying an Iterable extracting function (which might throw an exception) on them and concatenating the result lists into an array which becomes the new object under test.

public AbstractListAssert<?, List<? extends Object>, Object, ObjectAssert<Object>>

Returns:

a new assertion object whose object under test is the list of values extracted
flatExtracting
(String
the object transforming input object to an Iterable of desired ones
propertyName
)

Extract from array's elements the Iterable/Array values corresponding to the given property/field name and concatenate them into a single array becoming the new object under test.

protected TypeComparators
protected TypeComparators
public SELF
hasAtLeastOneElementOfType(Class<?>
the expected type.
type
)

Implements org.assertj.core.api.ObjectEnumerableAssert.hasAtLeastOneElementOfType.

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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.hasExactlyElementsOfTypes.

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
hasOnlyElementsOfType(Class<?>
the expected type.
type
)

Implements org.assertj.core.api.ObjectEnumerableAssert.hasOnlyElementsOfType.

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 classes and interfaces
types
)

Implements org.assertj.core.api.ObjectEnumerableAssert.hasOnlyElementsOfTypes.

Verifies that all elements of the actual array are instances of given classes or interfaces.
public SELF
hasOnlyOneElementSatisfying(Consumer<? super ELEMENT>
the assertions to perform on the unique element.
elementAssertions
)

Implements org.assertj.core.api.ObjectEnumerableAssert.hasOnlyOneElementSatisfying.

Verifies that the unique element of the array 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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.hasSameElementsAs.

An alias of containsOnlyElementsOf(Iterable) : verifies that actual contains all elements of the given Iterable and nothing else, in any order.
public SELF

Returns:

this assertion object.
hasSameSizeAs
(Object
the array to compare size with actual array.
other
)

Implements org.assertj.core.api.EnumerableAssert.hasSameSizeAs.

Verifies that the actual array has the same size as the given array.
public SELF

Returns:

this assertion object.
hasSameSizeAs
(Iterable<?>
the Iterable to compare size with actual array.
other
)

Implements org.assertj.core.api.EnumerableAssert.hasSameSizeAs.

Verifies that the actual array has the same size as the given Iterable.
public SELF
hasSize(int
the expected number of values in the actual group.
expected
)

Implements org.assertj.core.api.EnumerableAssert.hasSize.

Verifies that the number of values in the actual group is equal to the given one.
public SELF

Returns:

this assertion object.
hasSizeBetween
(int
the lower boundary compared to which actual size should be greater than or equal to.
lowerBoundary
,
int
the higher boundary compared to which actual size should be less than or equal to.
higherBoundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeBetween.

Verifies that the number of values in the actual array is between the given boundaries (inclusive).
public SELF

Returns:

this assertion object.
hasSizeGreaterThan
(int
the given value to compare the actual size to.
boundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeGreaterThan.

Verifies that the number of values in the actual array is greater than the given boundary.
public SELF

Returns:

this assertion object.
hasSizeGreaterThanOrEqualTo
(int
the given value to compare the actual size to.
boundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeGreaterThanOrEqualTo.

Verifies that the number of values in the actual array is greater than or equal to the given boundary.
public SELF

Returns:

this assertion object.
hasSizeLessThan
(int
the given value to compare the actual size to.
boundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeLessThan.

Verifies that the number of values in the actual array is less than the given boundary.
public SELF

Returns:

this assertion object.
hasSizeLessThanOrEqualTo
(int
the given value to compare the actual size to.
boundary
)

Implements org.assertj.core.api.EnumerableAssert.hasSizeLessThanOrEqualTo.

Verifies that the number of values in the actual array is less than or equal to the given boundary.
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.have.

Verifies that all elements satisfy the given condition.
public SELF
haveAtLeast(int
the minimum number of times the condition must hold.
times
,
Condition<? super ELEMENT>
the given condition.
condition
)

Implements org.assertj.core.api.ObjectEnumerableAssert.haveAtLeast.

Verifies that there are at least n elements in the actual array satisfying the given condition.
public SELF
haveAtLeastOne(Condition<? super ELEMENT>
the given condition.
condition
)

Implements org.assertj.core.api.ObjectEnumerableAssert.haveAtLeastOne.

Verifies that there is at least one element in the actual array satisfying the given condition.
public SELF
haveAtMost(int
the maximum number of times the condition must hold.
times
,
Condition<? super ELEMENT>
the given condition.
condition
)

Implements org.assertj.core.api.ObjectEnumerableAssert.haveAtMost.

Verifies that there are at most n elements in the actual array satisfying the given condition.
public SELF
haveExactly(int
the exact number of times the condition must hold.
times
,
Condition<? super ELEMENT>
the given condition.
condition
)

Implements org.assertj.core.api.ObjectEnumerableAssert.haveExactly.

Verifies that there are exactly n elements in the actual array satisfying the given condition.
public SELF
inBinary()

Overrides org.assertj.core.api.AbstractAssert.inBinary.

Use binary object representation instead of standard representation in error messages.
public SELF

Returns:

this assertion object.
inHexadecimal
()

Overrides org.assertj.core.api.AbstractAssert.inHexadecimal.

Enable hexadecimal object representation of Iterable elements instead of standard java representation in error messages.
private SELF
internalAllSatisfy(Consumer<? super ELEMENT> requirements)

private SELF
internalAnySatisfy(Consumer<? super ELEMENT> requirements)

private SELF
internalFilteredOn(Predicate<? super ELEMENT> predicate)

private SELF
internalFilteredOnAssertions(Consumer<? super ELEMENT> elementAssertions)

private SELF
internalNoneSatisfy(Consumer<? super ELEMENT> restrictions)

private ObjectAssert<ELEMENT>
public void
isEmpty()

Implements org.assertj.core.api.EnumerableAssert.isEmpty.

Verifies that the actual group of values is empty.
public SELF
isNotEmpty()

Implements org.assertj.core.api.EnumerableAssert.isNotEmpty.

Verifies that the actual group of values is not empty.
public void
isNullOrEmpty()

Implements org.assertj.core.api.EnumerableAssert.isNullOrEmpty.

Verifies that the actual group of values is null or empty.
public SELF
isSorted()

Implements org.assertj.core.api.ArraySortedAssert.isSorted.

Verifies that the actual array is sorted in ascending order according to the natural ordering of its elements.
public SELF
isSortedAccordingTo(Comparator<? super ELEMENT>
the Comparator used to compare array elements
comparator
)

Implements org.assertj.core.api.ArraySortedAssert.isSortedAccordingTo.

Verifies that the actual array is sorted according to the given comparator.
public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.isSubsetOf.

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

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.isSubsetOf.

Verifies that all elements of actual are present in the given values.
protected SELF
isSubsetOfForProxy(ELEMENT[] values)

protected <
the type of elements.
E
>
AbstractListAssert<?, List<? extends E>, E, ObjectAssert<E>>

Returns:

a new AbstractListAssert.
newListAssertInstance
(List<? extends E>
new value
newActual
)

Overrides org.assertj.core.api.AbstractAssert.newListAssertInstance.

Create a friendly soft or "hard" assertion.
protected abstract SELF
newObjectArrayAssert(ELEMENT[] array)

private SELF

Returns:

a new ObjectArrayAssert
newObjectArrayAssert
(List<ELEMENT>
the list to convert
filteredList
)

build a new ObjectArrayAssert from the filtered list propagating the assertion state (description, comparators, ...)

public SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.noneMatch.

Verifies that no elements match the given Predicate.
public SELF
noneSatisfy(Consumer<? super ELEMENT>
the given restrictions as Consumer that no elements should met.
restrictions
)

Implements org.assertj.core.api.ObjectEnumerableAssert.noneSatisfy.

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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.noneSatisfy.

Verifies that no elements satisfy the given restrictions expressed as a Consumer.
private static String
public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.satisfiesExactly.

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 final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.satisfiesExactly.

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...
protected SELF
satisfiesExactlyForProxy(Consumer<? super ELEMENT>[] requirements)

public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.satisfiesExactlyInAnyOrder.

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 final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.satisfiesExactlyInAnyOrder.

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).
protected SELF
satisfiesExactlyInAnyOrderForProxy(Consumer<? super ELEMENT>[] requirements)

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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.satisfiesOnlyOnce.

Verifies that there is exactly one element in the array under test 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
)

Implements org.assertj.core.api.ObjectEnumerableAssert.satisfiesOnlyOnce.

Verifies that there is exactly one element in the array under test that satisfies the ThrowingConsumer.
protected SELF
satisfiesOnlyOnceForProxy(Consumer<? super ELEMENT> requirements)

public ObjectAssert<ELEMENT>

Returns:

the assertion on the first element
singleElement
()

Verifies that the array under test contains a single element and allows to perform assertions on that element.

public <
the type of the resulting Assert
ASSERT extends AbstractAssert<?, ?>
>
ASSERT

Returns:

a new narrowed Assert instance for assertions chaining on the single element
singleElement
(InstanceOfAssertFactory<?, ASSERT>
the factory which verifies the type and creates the new Assert
assertFactory
)

Verifies that the array under test contains a single element and allows to perform assertions on that element, the assertions are strongly typed according to the given AssertFactory parameter.

public final SELF

Returns:

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

Implements org.assertj.core.api.ObjectEnumerableAssert.startsWith.

Verifies that the actual array starts with the given sequence of objects, without any other objects between them.
protected SELF
startsWithForProxy(ELEMENT[] sequence)

private ObjectAssert<ELEMENT>
toAssert(ELEMENT value, String description)

private ELEMENT[]
toGenericArray(List<ELEMENT> filteredList)

public <
the type of elements to compare.
C
>
SELF

Returns:

this assertions object
usingComparatorForElementFieldsWithNames
(Comparator<C> comparator, String...
the names of the properties and/or fields of the elements the comparator should be used for
elementPropertyOrFieldNames
)

Deprecated javadoc

Allows to set a comparator to compare properties or fields of elements with the given names.

public <
the type of elements to compare.
C
>
SELF

Returns:

this assertions object
usingComparatorForElementFieldsWithType
(Comparator<C> comparator, Class<C>
the java.lang.Class of the type of the element fields the comparator should be used for
type
)

Deprecated javadoc

Allows to set a specific comparator to compare properties or fields of elements with the given type.

public <
the type of elements to compare.
C
>
SELF

Returns:

this assertions object
usingComparatorForType
(Comparator<C> comparator, Class<C>
the java.lang.Class of the type of the element or element fields the comparator should be used for
type
)

Allows to set a specific comparator for the given type of elements or their fields.

public SELF
usingDefaultElementComparator()

Implements org.assertj.core.api.EnumerableAssert.usingDefaultElementComparator.

Revert to standard comparison for incoming assertion group element checks.
public SELF

Returns:

this assertion object.
usingElementComparator
(Comparator<? super ELEMENT>
the comparator to use for incoming assertion checks.
elementComparator
)

Implements org.assertj.core.api.EnumerableAssert.usingElementComparator.

Use given custom comparator instead of relying on actual type A equals method to compare group elements for incoming assertion checks.
public SELF

Returns:

this assertion object.
usingElementComparatorIgnoringFields
(String...
the name of the fields to ignore
fields
)

Deprecated This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparatorIgnoringFields(String...) instead.
Deprecated javadoc

Use field/property by field/property on all fields/properties except the given ones (including inherited fields/properties) instead of relying on actual type A equals method to compare group elements for incoming assertion checks.

public SELF

Returns:

this assertion object.
usingElementComparatorOnFields
(String...
the name of the fields to use the element comparator on
fields
)

Deprecated This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparatorOnFields(String...) instead.
Deprecated javadoc

Use field/property by field/property comparison on the given fields/properties only (including inherited fields/properties) instead of relying on actual type A equals method to compare group elements for incoming assertion checks.

private SELF
public SELF

Returns:

this assertion object.
usingFieldByFieldElementComparator
()

Deprecated This method is deprecated because it performs a shallow field by field comparison, i.e. elements are compared field by field but the fields are compared with equals, use usingRecursiveFieldByFieldElementComparator() or usingRecursiveComparison() instead to perform a true recursive comparison.
Deprecated javadoc

Use field/property by field/property comparison (including inherited fields/properties) instead of relying on actual type A equals method to compare group elements for incoming assertion checks.

public RecursiveAssertionAssert

Returns:

A new instance of RecursiveAssertionAssert built with a default RecursiveAssertionConfiguration.
usingRecursiveAssertion
()

Overrides org.assertj.core.api.AbstractAssert.usingRecursiveAssertion.

Asserts that the given predicate is met for all fields of the object under test recursively (but not the object itself).

public RecursiveAssertionAssert

Returns:

A new instance of RecursiveAssertionAssert built with a default RecursiveAssertionConfiguration.
usingRecursiveAssertion
(RecursiveAssertionConfiguration
The recursion configuration described above.
recursiveAssertionConfiguration
)

Overrides org.assertj.core.api.AbstractAssert.usingRecursiveAssertion.

The same as usingRecursiveAssertion(), but this method allows the developer to pass in an explicit recursion configuration.

public RecursiveComparisonAssert<?>

Returns:

a new RecursiveComparisonAssert instance
usingRecursiveComparison
()

Overrides org.assertj.core.api.AbstractAssert.usingRecursiveComparison.

Enable using a recursive field by field comparison strategy when calling the chained RecursiveComparisonAssert,

Example:

 public class Person {
  String name;
  boolean hasPhd;
}

public class Doctor {
 String name;
 boolean hasPhd;
}

Doctor drSheldon = new Doctor("Sheldon Cooper", true);
Doctor drLeonard = new Doctor("Leonard Hofstadter", true);
Doctor drRaj = new Doctor("Raj Koothrappali", true);

Person sheldon = new Person("Sheldon Cooper", true);
Person leonard = new Person("Leonard Hofstadter", true);
Person raj = new Person("Raj Koothrappali", true);
Person howard = new Person("Howard Wolowitz", false);

Doctor[] doctors = { drSheldon, drLeonard, drRaj };
Person[] people = { sheldon, leonard, raj };

// assertion succeeds as both lists contains equivalent items in order.
public RecursiveComparisonAssert<?>
public SELF

Returns:

this assertion object.
usingRecursiveFieldByFieldElementComparator
()

Enable using a recursive field by field comparison strategy similar to usingRecursiveComparison() but contrary to the latter you can chain any iterable assertions after this method (this is why this method exists).

public SELF

Returns:

this assertion object.
usingRecursiveFieldByFieldElementComparator
(RecursiveComparisonConfiguration
the recursive comparison configuration.
configuration
)

Enable using a recursive field by field comparison strategy similar to usingRecursiveComparison() but contrary to the latter you can chain any iterable assertions after this method (this is why this method exists).

public SELF

Returns:

this assertion object.
usingRecursiveFieldByFieldElementComparatorIgnoringFields
(String...
the field names to exclude in the elements comparison.
fields
)

The assertions chained after this method will use a recursive field by field comparison on all fields (including inherited fields) except the given ones instead of relying on the element equals method.

public SELF

Returns:

this assertion object.
usingRecursiveFieldByFieldElementComparatorOnFields
(String...
the field names to exclude in the elements comparison.
fields
)

The assertions chained after this method will use a recursive field by field comparison on the given fields (including inherited fields) instead of relying on the element equals method.

pack-priv SELF
pack-priv SELF
withComparatorsForElementPropertyOrFieldNames(Map<String, Comparator<?>> comparatorsForElementPropertyOrFieldNames)

pack-priv SELF
withComparatorsForElementPropertyOrFieldTypes(TypeComparators comparatorsForElementPropertyOrFieldTypes)

pack-priv SELF
pack-priv SELF
pack-priv SELF
public <
the type of the other array elements.
OTHER_ELEMENT
>
SELF

Returns:

this assertion object.
zipSatisfy
(OTHER_ELEMENT[]
the array to zip actual with.
other
,
BiConsumer<? super ELEMENT, OTHER_ELEMENT>
the given requirements that each pair must satisfy.
zipRequirements
)

Verifies that the zipped pairs of actual and other elements, i.e: (actual 1st element, other 1st element), (actual 2nd element, other 2nd element), ...

Inherited from org.assertj.core.api.AbstractAssert:
areEqualasInstanceOfasListassertionErrorasStringdescribedAsdescriptionTextdoesNotHavedoesNotHaveSameClassAsdoesNotHaveSameHashCodeAsdoesNotHaveToStringdoesNotHaveToStringequalsextractingextractingfailurefailureWithActualExpectedfailWithActualExpectedAndMessagefailWithMessagegetWritableAssertionInfohashashCodehasSameClassAshasSameHashCodeAshasToStringhasToStringisisElementOfCustomAssertisEqualToisExactlyInstanceOfisInisInisInstanceOfisInstanceOfAnyisInstanceOfSatisfyingisNotisNotEqualToisNotExactlyInstanceOfisNotInisNotInisNotInstanceOfisNotInstanceOfAnyisNotNullisNotOfAnyClassInisNotSameAsisNullisOfAnyClassInisSameAsmatchesmatchesoverridingErrorMessageoverridingErrorMessagesatisfiessatisfiessatisfiessatisfiesAnyOfsatisfiesAnyOfsatisfiesAnyOfForProxysatisfiesForProxysetCustomRepresentationsetDescriptionConsumersetPrintAssertionsDescriptionthrowAssertionErrorusingComparatorusingComparatorusingDefaultComparatorwithFailMessagewithFailMessagewithRepresentationwithThreadDumpOnError