最佳答案
Hamcrest 为断言集合的内容提供了许多匹配器:
Collection<String> c = ImmutableList.of("one", "two", "three");
assertThat(c, hasItems("one", "two", "three");
assertThat(c, contains("one", "two", "three");
assertThat(c, containsInAnyOrder("one", "two", "three");
hasItems
、 contains
和 containsInAnyOrder
有什么不同?