I've ran into an issue with hamcrest and mockito. Here is what I'm trying to do:
public class A{
public void foo(List<B> arg){
return;
}
}
public BMatcher extends BaseMatcher<B>{
//Some impl...
}
In my test I want to do something like
A a = mock(A.class);
B expected = new B();
Mockito.verify(a).foo(argThat(JUnitMatchers.hasItem(new BMatcher(expected)));
However, the hasItem
matcher returns an Iterable<B>
while the foo method expects a List<B>
.
Is there any good way of verifying the method is called properly?