-
-
Notifications
You must be signed in to change notification settings - Fork 766
Closed
Milestone
Description
Feature summary
It would be helpful to be able to supply a custom predicate description to all predicate-based iterable assertions (allMatch, anyMatch and noneMatch). Currently only allMatch allows supplying a custom predicate description.
From the docs (under the example for all 3):
"You can pass a predicate description to make the error message more explicit if the assertion fails" under the example of all three.
It would be good to keep the docs aligned to the functionality, although in this case aligning the functionality to the docs would be preferable.
Example
List<String> myList = List.of("a", "b", "cc");
assertThat(myList).allMatch(entry -> entry.length() == 2, "length of 2"); // ✅
assertThat(myList).anyMatch(entry -> entry.length() == 2, "length of 2"); // ❌
assertThat(myList).noneMatch(entry -> entry.length() == 2, "length of 2"); // ❌Metadata
Metadata
Assignees
Labels
No labels