I'm using Hamcrest's containsInAnyOrder matcher when asserting REST response using Rest Assured. Here's an example of my assertion:
assertThat(
body.jsonPath().getList("zones.name"),
containsInAnyOrder(values.getName().toArray()));
First argument returns a List. Second argument (values.getName()) also returns a List. But Intellij IDEA shows an error on a mactcher: Unchecked generics array creation for varargs parameter. When I run this assertions, I get java.lang.AssertionError. When I convert second argument to an array, like values.getName().toArray(), I get everything working as expected.
So I can't understand why comparing a List with a List doesn't work, but List with an array does? Why do I need to convert the second argument to an array?