I am using AssertJ and I am trying to assert that two List<String>
contain same strings, ignoring the order.
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);
How can I fix the compilation error below that is appearing when trying to use containsExactlyInAnyOrder()
?
"The method containsExactlyInAnyOrder(String...) in the type ListAssert is not applicable for the arguments (List)"
import static org.assertj.core.api.Assertions.assertThat;
and not one of its cousins from other packages. – Gave