Tag: wildcard

  1. Mocking method with wildcard generic return type

    There are several cases where construction when().thenReturn is not suitable during Unit tests. One of then generic return type. I have faced such issue, let's take a look. There is a method in interface declaration: public interface FooInterface { public Iterable<? extends SomeClass> getList(); ... } Implementation looks like this:…

    on mockito java junit doReturn generic wildcard