The input:
- Collection with MyElement without equals method.
- A org.hamcrest.TypeSafeMatcher implementation, which matches element by some field.
The goal is make following statement compilable:
Collection<MyElement> elements = ...
Collection<TypeSafeMatchert> matchers = ...
assertThat(elements, Matchers.contains(matchers); //<error here
What have to use here? It wants me to Matcher<? super java.util.List<MyElement>>
and told that actully I passed Matcher<java.lang.Iterable<? super java.util.List<MyElement>>>
. So how to pass a Matcher Collection here?
There is a question about comparing collections with hamcrest, but there is no example with passing Matchers collection, not elements.