Mockito isA(Class clazz) How to resolve type safety?
Mockito/Hamcrest and generic classes Yes, this is a general problem with Mockito/Hamcrest. Generally using isA() with generic classes produces a warning. There are predifined Mockito matchers for the most common generic classes: anyList(), anyMap(), anySet() and anyCollection(). Suggestions: anyIterable() in Mockito 2.1.0 Mockito 2.1.0 added a new anyIterable() method for matching Iterables: when(client.runTask(anyString(), anyString(), anyIterable()).thenReturn(…) … Read more