Mockito’s Matcher vs Hamcrest Matcher?
Hamcrest matcher methods return Matcher<T> and Mockito matchers return T. So, for example: org.hamcrest.Matchers.any(Integer.class) returns an instance of org.hamcrest.Matcher<Integer>, and org.mockito.Matchers.any(Integer.class) returns an instance of Integer. That means that you can only use Hamcrest matchers when a Matcher<?> object is expected in the signature – typically, in assertThat calls. When setting up expectations or verifications … Read more