Can't compile a Mockito code

What’s wrong with this code? It doesn’t compile

        Authentication authenticationMock = mock(Authentication.class);
        List<GrantedAuthority> roles = List.of(
                new SimpleGrantedAuthority("user"),
                new SimpleGrantedAuthority("admin")
        );
        Mockito.when(authenticationMock.getAuthorities()).thenReturn(roles);
C:\Users\NadChel\IdeaProjects\dynamic-gateway\src\test\java\com\example\dynamicgateway\service\paramInitializer\impl\RolesParamInitializerTest.java:25:58
java: no suitable method found for thenReturn(java.util.List<org.springframework.security.core.GrantedAuthority>)
    method org.mockito.stubbing.OngoingStubbing.thenReturn(java.util.Collection<capture#1 of ? extends org.springframework.security.core.GrantedAuthority>) is not applicable
      (argument mismatch; java.util.List<org.springframework.security.core.GrantedAuthority> cannot be converted to java.util.Collection<capture#1 of ? extends org.springframework.security.core.GrantedAuthority>)
    method org.mockito.stubbing.OngoingStubbing.thenReturn(java.util.Collection<capture#1 of ? extends org.springframework.security.core.GrantedAuthority>,java.util.Collection<capture#1 of ? extends org.springframework.security.core.GrantedAuthority>...) is not applicable
      (argument mismatch; java.util.List<org.springframework.security.core.GrantedAuthority> cannot be converted to java.util.Collection<capture#1 of ? extends org.springframework.security.core.GrantedAuthority>)
no suitable method found for thenReturn

do you have a method thenReturn? Does that class have it? Did you mean to type something else?