Seems very stupid, but I can't find good solution to this (I guess very basic) problem: I have an list with elements that can not be checked by equals
. Instead, I want to assert items state by their properties, and I want to do it ignoring item order.
assertThat(list.get(xx))
doesn't fit, as it assumes knowing exact order.
assertThat(list).containsInAnyOrder(xx, yyy, ...)
doesn't fit as it assumes being able to compare objects by equals()
.
What I miss is something like assertThat(list).containsInAnyOrder( Consumer<ObjectAssert<T>>...itemAssertions )
.
As a bonus, in my case I already have custom Assertion for my object type T, but I guess that would require really flexible API to use that for list items.
What do I miss?