包含的相反是什么?
List<String> list = Arrays.asList("b", "a", "c");
// should fail, because "d" is not in the list
expectedInList = new String[]{"a","b", "c", "d"};
Assert.assertThat(list, Matchers.contains(expectedInList));
// should fail, because a IS in the list
shouldNotBeInList = Arrays.asList("a","e", "f", "d");
Assert.assertThat(list, _does_not_contains_any_of_(shouldNotBeInList)));
应该包含哪些内容,_does_not_contains_any_of_
代表什么?
contains
方法?例如!contains(shouldNotBeInList)
。我还没有做过这样的操作,所以不确定是否可行,但值得一试。 - Hypnic Jerk