Using AssertJ in a unit test, I want to extract several properties of a custom object from a list of such objects via extracting and check if they are all non-null.
For example, assuming I want to extract fieldA and fieldB of MyObject:
import static from org.assertj.core.api.Assertions.assertThat;
List<MyObject> theList = ...;
assertThat(theList).extracting("fieldA", "fieldB")).isNotNull();
I am having trouble figuring out what is being checked.
Is isNotNull checking that:
- the iterable returned by
extractingis not null? - no tuples in the list are null?
- every value in every tuple is not null?

Following your example:
isNotNullonly checks that theIterableof tuples returned byextractingis not null.flatExtracting+doesNotContainNullTo check that none of the extracted values are null, you can use
flatExtractinganddoesNotContainNull:which yields a message like the following in case of failures:
Due to the flattened nature of the solution, there is no indication of which object caused the failure but can be identified by counting the pairs in the displayed
actual.extracting+noneMatchThe complexity can be increased for clearer error messages:
which yields in case of failure:
extracting+allSatisfy+doesNotContainNullAnother option for clearer error messages:
which yields in case of failure: