I try to use Hamcrest, but constantly come across the following:
Hamcrest connectors are short-circuited, so for example, if I write:
Assert.assertThat(list, everyItem(not(isIn(shouldNotBeInList))));
Only the first erroneous shouldNotBeInList element is reported. I expect the tests will tell me as much as possible.
Can I write statements in hamcrest so that they are clearly reported, so that all inconsistencies are reported, or should I create my own interlocutors or use another library?
Output example for
List<String> list = Arrays.asList("a", "b", "c"); List<String> shouldNotBeInList = Arrays.asList("c", "e", "a");
Note the error message for c
Expected: every item is not one of {"c", "e", "a"} but: an item was "a"
source share