I want to assert equality of two collection using hamcrest.
I know there is contains
matcher but I want it to ignore ordering.
{1,2} is equals to {2,1} for my need.
What is the right syntax?
Use containsInAnyOrder()
:
List colors = Arrays.asList("red","green","blue");
assertThat(colors, containsInAnyOrder("green", "red", "blue")); // is true