我正在使用AssertJ,并且我试图断言两个List<String>
包含相同的字符串,而忽略了顺序。
List<String> expected = Arrays.asList("Something-6144-77.pdf", "d-6144-77.pdf", "something-6144-78.pdf", "Something-6144-8068.pdf");
List<String> actual = new ArrayList<String>();
assertThat(actual.size()).isEqualTo(expected.size());
// This line gives the error: "The method containsExactlyInAnyOrder(String...) in the type ListAssert<String> is not applicable for the arguments (List<String>)"
assertThat(actual).containsExactlyInAnyOrder(expected);
如何修复尝试使用时出现的以下编译错误containsExactlyInAnyOrder()
?
“ListAssert 类型中的方法 containsExactlyInAnyOrder(String...) 不适用于参数 (List)”