-
-
Notifications
You must be signed in to change notification settings - Fork 774
Closed
✨ New Feature
Copy link
Milestone
Description
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 -> {}
); Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels