You can use contains
matcher instead, but you probably need to use latest version of Hamcrest. That method checks the order.
assertThat(list, contains("foo", "boo"));
You can also try using containsInAnyOrder
if order does not matter to you.
That's the code for contains
matcher:
public static <E> Matcher<Iterable<? extends E>> contains(List<Matcher<? super E>> itemMatchers)
{
return IsIterableContainingInOrder.contains(itemMatchers);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…