如何断言两个列表<字符串>相等,忽略顺序
我正在使用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()
“该方法包含ExactlyInAnyOrder(String...)在类型中 ListAssert 不适用于参数 (List)”