Feature summary
I need to assert with satisfiesAnyOf for each element in an iterable.
This may be a collection version of #1304 .
List<Some> some = getSome();
// Now each some.other should be asserted by any of multiple conditions.
some.stream.map(Some::getOther).forEach(o -> {
assertThat(o).satisfiesAnyOf(
o1 -> assertThat(o1).isNull(),
o1 -> assertThat(o1).isNotNull().extracting(Other::getId).isEqualTo(x);
);
});
assertThat(some)
.extracting(Some::getOther)
.allSatisfy(o -> {
assertThat(o).satisfiesAnyOf(
o1 -> assertThat(o1).isNull(),
o1 -> assertThat(o1).isNotNull().extracting(Other::getId).isEqualTo(x);
);
});
Example
List<Some> some = getSome();
assertThat(some)
.isNotEmpty()
.extracting(Some::getOther)
.allSatisfyAnyOf( // or eachSatisfiesAnyOf
o -> {},
o -> {}
);
Feature summary
I need to assert with
satisfiesAnyOffor each element in an iterable.This may be a collection version of #1304 .
Example