To create an instance of this class, invoke .
Assertions#assertThat(Object[])
| Modifier and Type | Field and Description |
|---|---|
| pack-priv ObjectArrays | |
| private static final String | |
| pack-priv TypeComparators | |
| pack-priv Map | |
| pack-priv TypeComparators | |
| pack-priv Iterables |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public SELF | Returns: this object.the given predicate)Predicate.Implements org. Predicate.
|
| public SELF | |
| public SELF | allSatisfy(Consumer<? super ELEMENT>
the given requirements)Consumer.Implements org. Consumer.
|
| public SELF | Returns: this object.the given requirements)ThrowingConsumer.Implements org. ThrowingConsumer.
|
| public SELF | Returns: this object.the given predicate)Predicate.Implements org. Predicate.
|
| public SELF | anySatisfy(Consumer<? super ELEMENT>
the given requirements)Consumer.Implements org. Consumer.
|
| public SELF | Returns: this object.the given requirements)ThrowingConsumer.Implements org. ThrowingConsumer.
|
| public SELF | Returns: this object.the given condition. condition)Implements org. Example :
|
| public SELF | Returns: this object.the minimum number of times the condition should be verified. times, Condition<? super ELEMENT> the given condition. condition)Implements org. |
| public SELF | areAtLeastOne(Condition<? super ELEMENT>
the given condition. condition)Implements org. |
| public SELF | Returns: this object.the number of times the condition should be at most verified. times, Condition<? super ELEMENT> the given condition. condition)Implements org. |
| public SELF | Returns: this object.the exact number of times the condition should be verified. times, Condition<? super ELEMENT> the given condition. condition)Implements org. |
| public SELF | Returns: this object.the given condition. condition)Implements org. Example :
|
| public SELF | as(Description
the new description to set. description)Overrides default org. |
| public SELF | as(String
the new description to set. description, Object... optional parameter if description is a format String. args)Overrides default org. |
| public final SELF | Returns: this assertion object.the given values. values)Implements org. |
| public SELF | Returns: this assertion object.the object to look for. value, Index the index where the object should be stored in the actual array. index)Implements org. |
| public SELF | Returns: this assertion object.the given iterable)Iterable we will get elements from.Implements org. Iterable, in any order.
|
| public SELF | Returns: this assertion object.the iterable whose at least one element is expected to be in the array under test. iterable)Implements org. Iterable elements.
|
| public final SELF | Returns: this assertion object.the values whose at least one which is expected to be in the array under test. values)Implements org. |
| protected SELF | |
| public final SELF | Returns: this assertion object.the given values. values)Implements org. |
| public SELF | containsExactlyElementsOf(Iterable<? extends ELEMENT>
the given iterable)Iterable we will get elements from.Implements org. 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 | |
| public final SELF | Returns: this assertion object.the given values. values)Implements org. |
| public SELF | containsExactlyInAnyOrderElementsOf(Iterable<? extends ELEMENT>
the given values. values)Implements org. |
| protected SELF | |
| protected SELF | |
| public SELF | Returns: this assertion object.Implements org. |
| public final SELF | Returns: this assertion object.the given values. values)Implements org. |
| public SELF | containsOnlyElementsOf(Iterable<? extends ELEMENT>
the given iterable)Iterable we will get elements from.Implements org. 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 | |
| public SELF | Returns: this assertion object.Implements org. |
| public final SELF | Returns: this assertion object.the given values. values)Implements org. |
| public SELF | containsOnlyOnceElementsOf(Iterable<? extends ELEMENT>
the given iterable)Iterable we will get elements from.Implements org. containsOnlyOnce(Object. : verifies that the actual group contains the elements of
the given iterable only once.
|
| protected SELF | |
| public final SELF | Returns: this assertion object.the sequence of objects to look for. sequence)Implements org. |
| public SELF | Returns: this assertion object.the sequence of objects to look for. sequence)Implements org. |
| protected SELF | |
| public final SELF | Returns: this assertion object.the subsequence of objects to look for. subsequence)Implements org. |
| public SELF | Returns: this assertion object.the subsequence of objects to look for. subsequence)Implements org. |
| protected SELF | |
| public SELF | Returns: this assertion object.the object to look for. value, Index the index where the object should not be stored in the actual array. index)Implements org. |
| public final SELF | Returns: this assertion object.the given values. values)Implements org. |
| public SELF | Returns: this assertion object.the iterable)Iterable whose elements must not be in the actual array.Implements org. Iterable (i.e. none).
|
| protected SELF | |
| public SELF | Returns: this assertion object.Implements org. |
| public final SELF | Returns: this assertion object.the sequence of objects to look for. sequence)Implements org. |
| public SELF | Returns: this assertion object.the sequence of objects to look for. sequence)Implements org. |
| protected SELF | |
| public final SELF | Returns: this assertion object.the subsequence of objects to look for. subsequence)Implements org. |
| public SELF | Returns: this assertion object.the subsequence of objects to look for. subsequence)Implements org. |
| protected SELF | |
| public SELF | doesNotHaveAnyElementsOfTypes(Class<?>...
the not expected types. unexpectedTypes)Implements org. Object group do not belong to the specified types (including subclasses).
|
| public SELF | Returns: this assertion object.Implements org. |
| private <V, C extends Collection | |
| public SELF | Returns: this object.the given condition. condition)Implements org. |
| public SELF | Returns: this assertion object.the sequence of objects to look for. sequence)Implements org. |
| public final SELF | Returns: this assertion object.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. |
| protected SELF | |
| public AbstractListAssert | Returns: a new assertion object whose object under test is the list of extracted field/property values.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 | Returns: a new assertion object whose object under test is the list of extracted field/property values.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 | Returns: a new assertion object whose object under test is the list of Tuple with extracted properties/fields values as data.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 | Returns: a new assertion object whose object under test is the list of extracted values.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 EXCEPTION extends Exception> AbstractListAssertThrowingExtractor | Returns: a new assertion object whose object under test is the list of extracted valuesthe 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 | Returns: a new assertion object whose object under test is the list of Tuples containing the extracted values.the extractor functions to extract a value from an element of the array under test. extractors)Use the given |
| protected AbstractListAssert | |
| public AbstractListAssert | Returns: a new assertion object whose object under test is the list of extracted values.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 | Returns: a new assertion object whose object under test is the list of extracted values.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 testthe 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
|
| public SELF | Returns: a new assertion object with the filtered list under testthe 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 |
| public SELF | Returns: a new assertion object with the filtered list under testthe filter condition / predicate condition)Filter the array under test into a list composed of the elements matching the given |
| public SELF | Returns: a new assertion object with the filtered list under testthe filter predicate predicate)Filter the array under test into a list composed of the elements matching the given |
| public < result type of the filter function T> SELF | Returns: a new assertion object with the filtered list under testthe 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 |
| public SELF | Returns: a new assertion object with the filtered iterable under testcontaining AssertJ assertions to filter on elementAssertions)Filter the array under test keeping only elements matching the given assertions specified with a |
| public SELF | Returns: a new assertion object with the filtered iterable under testcontaining AssertJ assertions to filter on elementAssertions)Filter the array under test keeping only elements matching the given assertions specified with a |
| public SELF | Returns: a new assertion object with the filtered list under testthe 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 |
| public < the type of elements to extract. V, the type of collection to flat/extract. C extends Collection | Returns: a new assertion object whose object under test is the list of values extractedthe 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 Collectionthe exception type of EXCEPTION extends Exception> AbstractListAssertThrowingExtractor | Returns: a new assertion object whose object under test is the list of values extractedthe 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 | Returns: a new assertion object whose object under test is the list of values extractedthe 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. Object group has the specified type (matching
includes subclasses of the given type).
|
| public SELF | Returns: this assertion object.the expected types expectedTypes)Implements org. |
| public SELF | hasOnlyElementsOfType(Class<?>
the expected type. type)Implements org. Object group belong to the specified type (matching includes
subclasses of the given type).
|
| public SELF | Returns: this assertion object.the expected classes and interfaces types)Implements org. |
| public SELF | hasOnlyOneElementSatisfying(Consumer<? super ELEMENT>
the assertions to perform on the unique element. elementAssertions)Implements org. Consumer,
if it does not, only the first error is reported, use SoftAssertions to get all the errors.
|
| public SELF | Returns: this assertion objectthe iterable)Iterable whose elements we expect to be presentImplements org. containsOnlyElementsOf(Iterable) : verifies that actual contains all elements of the
given Iterable and nothing else, in any order.
|
| public SELF | Returns: this assertion object.the array to compare size with actual array. other)Implements org. |
| public SELF | Returns: this assertion object.the other)Iterable to compare size with actual array.Implements org. Iterable.
|
| public SELF | hasSize(int
the expected number of values in the actual group. expected)Implements org. |
| public SELF | Returns: this assertion object.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. |
| public SELF | Returns: this assertion object.the given value to compare the actual size to. boundary)Implements org. |
| public SELF | Returns: this assertion object.the given value to compare the actual size to. boundary)Implements org. |
| public SELF | Returns: this assertion object.the given value to compare the actual size to. boundary)Implements org. |
| public SELF | Returns: this assertion object.the given value to compare the actual size to. boundary)Implements org. |
| public SELF | Returns: this object.the given condition. condition)Implements org. |
| public SELF | haveAtLeast(int
the minimum number of times the condition must hold. times, Condition<? super ELEMENT> the given condition. condition)Implements org. |
| public SELF | haveAtLeastOne(Condition<? super ELEMENT>
the given condition. condition)Implements org. |
| public SELF | haveAtMost(int
the maximum number of times the condition must hold. times, Condition<? super ELEMENT> the given condition. condition)Implements org. |
| public SELF | haveExactly(int
the exact number of times the condition must hold. times, Condition<? super ELEMENT> the given condition. condition)Implements org. |
| public SELF | inBinary()
Overrides org. |
| public SELF | Returns: this assertion object.Overrides org. |
| private SELF | |
| private SELF | |
| private SELF | |
| private SELF | |
| private SELF | |
| private ObjectAssert | |
| public void | isEmpty()
Implements org. |
| public SELF | isNotEmpty()
Implements org. |
| public void | isNullOrEmpty()
Implements org. null or empty.
|
| public SELF | isSorted()
Implements org. |
| public SELF | isSortedAccordingTo(Comparator<? super ELEMENT>
the comparator)Comparator used to compare array elementsImplements org. |
| public SELF | Returns: this assertion object.the values)Iterable that should contain all actual elements.Implements org. Iterable.
|
| public final SELF | Returns: this assertion object.the values that should be used for checking the elements of actual. values)Implements org. |
| protected SELF | |
| protected String | |
| protected < the type of elements. E> AbstractListAssert | Returns: a newAbstractListAssert.new value newActual)Overrides org. |
| protected abstract SELF | |
| private SELF | Returns: a new ObjectArrayAssertthe list to convert filteredList)build a new ObjectArrayAssert from the filtered list propagating the assertion state (description, comparators, ...) |
| public SELF | Returns: this object.the given predicate)Predicate.Implements org. Predicate.
|
| public SELF | noneSatisfy(Consumer<? super ELEMENT>
the given restrictions as restrictions)Consumer that no elements should met.Implements org. Consumer.
|
| public SELF | Returns: this object.the given restrictions)ThrowingConsumer.Implements org. Consumer.
|
| private static String | |
| public final SELF | Returns: this to chain assertions.the requirements to meet. requirements)Implements org. |
| public final SELF | Returns: this to chain assertions.the requirements to meet. requirements)Implements org. |
| protected SELF | |
| public final SELF | Returns: this assertion object.the consumers that are expected to be satisfied by the elements of the given requirements)Iterable.Implements org. |
| public final SELF | Returns: this assertion object.the consumers that are expected to be satisfied by the elements of the given requirements)Iterable.Implements org. 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 | |
| public SELF | Returns: this assertion object.the requirements)Consumer that is expected to be satisfied only once by the elements of the given Iterable.Implements org. Consumer.
|
| public SELF | Returns: this assertion object.the requirements)ThrowingConsumer that is expected to be satisfied only once by the elements of the given Iterable.Implements org. ThrowingConsumer.
|
| protected SELF | |
| public ObjectAssert | Returns: the assertion on the first elementVerifies that the array under test contains a single element and allows to perform assertions on that element. |
| public < the type of the resulting ASSERT extends AbstractAssertAssert | Returns: a new narrowedAssert instance for assertions chaining on the single elementthe factory which verifies the type and creates the new assertFactory)AssertVerifies 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 |
| public final SELF | Returns: this assertion object.the sequence of objects to look for. sequence)Implements org. |
| protected SELF | |
| private ObjectAssert | |
| private ELEMENT[] | |
| public < the type of elements to compare. C> SELF | Returns: this assertions objectthe comparator, String... java. to usethe names of the properties and/or fields of the elements the comparator should be used for elementPropertyOrFieldNames)
Deprecated
This method is used with
Deprecated javadoc
usingFieldByFieldElementComparator() which is deprecated in favor of
usingRecursiveFieldByFieldElementComparator(RecursiveComparisonConfiguration) or usingRecursiveComparison().
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 objectthe comparator, Class<C> java. to usethe type)java. of the type of the element fields the comparator should be used for
Deprecated
This method is used with
Deprecated javadoc
usingFieldByFieldElementComparator() which is deprecated in favor of
usingRecursiveFieldByFieldElementComparator(RecursiveComparisonConfiguration) or usingRecursiveComparison().
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 objectthe comparator, Class<C> java. to usethe type)java. of the type of the element or element fields the comparator should be used forAllows to set a specific comparator for the given type of elements or their fields. |
| public SELF | usingDefaultElementComparator()
Implements org. |
| public SELF | Returns: this assertion object.the comparator to use for incoming assertion checks. elementComparator)Implements org. equals method to compare group
elements for incoming assertion checks.
|
| public SELF | Returns: this assertion object.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
Deprecated javadoc
usingRecursiveFieldByFieldElementComparatorIgnoringFields(String. instead.
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 |
| public SELF | Returns: this assertion object.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
Deprecated javadoc
usingRecursiveFieldByFieldElementComparatorOnFields(String. instead.
Use field/property by field/property comparison on the given fields/properties only (including inherited
fields/properties) instead of relying on actual type A |
| private SELF | |
| public SELF | Returns: this assertion object.
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
Deprecated javadoc
usingRecursiveFieldByFieldElementComparator()
or usingRecursiveComparison() instead to perform a true recursive comparison.
Use field/property by field/property comparison (including inherited fields/properties) instead of relying on
actual type A |
| public RecursiveAssertionAssert | Returns: A new instance ofRecursiveAssertionAssert built with a default RecursiveAssertionConfiguration.Overrides org. 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 ofRecursiveAssertionAssert built with a default RecursiveAssertionConfiguration.The recursion configuration described above. recursiveAssertionConfiguration)Overrides org. The same as |
| public RecursiveComparisonAssert | Returns: a newRecursiveComparisonAssert instanceOverrides org. RecursiveComparisonAssert,
Example:
|
| public RecursiveComparisonAssert | Returns: a newRecursiveComparisonAssert instance built with the given RecursiveComparisonConfiguration.the recursiveComparisonConfiguration)RecursiveComparisonConfiguration used in the chained isEqualTo assertion.Overrides org. usingRecursiveComparison() but allows to specify your own RecursiveComparisonConfiguration.
|
| public SELF | Returns: this assertion object.Enable using a recursive field by field comparison strategy similar to |
| public SELF | Returns: this assertion object.the recursive comparison configuration. configuration)Enable using a recursive field by field comparison strategy similar to |
| public SELF | Returns: this assertion object.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 |
| public SELF | Returns: this assertion object.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 |
| pack-priv SELF | withAssertionState(AbstractAssert<SELF extends AbstractAssert<SELF, ACTUAL>, ACTUAL> assertInstance)
Overrides org. |
| 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.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), ... |