How do Hamcrest’s hasItems, contains and containsInAnyOrder differ?
hasItems checks: consecutive passes over the examined Iterable yield at least one item that is equal to the corresponding item from the specified items. That is, it makes sure that the collections contains at least these items, in any order. So, assertThat(c, hasItems(“one”, “two”)); would also pass, with the extra item being ignored. And: assertThat(c, … Read more