“Cannot resolve method” with mockito

Try using the other syntax to return your collection with a wildcard matching generic:
doReturn(grantedAuthorities).when(authentication).getAuthorities();

This doReturn call isn’t type-safe and results in a runtime check on type but for your purposes it will return the mocked list you want.

There are a lot of details using mockito and generics with wildcards. For more details:
http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeArguments.html#Wildcards

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)