"Cannot resolve method" with mockito : <p>I use <code>org.springframework.security.core.Authentication</code> which has a method:</p>

<pre><code>Collection&lt;? extends GrantedAuthority&gt; getAuthorities();
</code></pre>

<p>I want to mock it as below:</p>

<pre><code>when(authentication.getAuthorities()).thenReturn(grantedAuthorities);
</code></pre>

<p>with authorities collection:</p>

<pre><code>Collection&lt;SimpleGrantedAuthority&gt; grantedAuthorities = Lists.newArrayList(
        new SimpleGrantedAuthority(AuthoritiesConstants.USER));
</code></pre>

<p>And I am using <code>org.springframework.security.core.authority.SimpleGrantedAuthority</code> which extends <code>GrantedAuthority</code></p>

<p>And Intellij gives me below compile error:</p>

<pre><code>Cannot resolve method 'thenReturn(java.util.Collection&lt;org.spring.security.core.authority.SimpleGrantedAuthority&gt;)'
</code></pre>

<p>I use Mockito <code>2.15.0</code> and <code>thenReturn()</code> method from it is:</p>

<pre><code>OngoingStubbing&lt;T&gt; thenReturn(T value);
</code></pre>

<p>What is the problem?</p>
