@Test
  public void testGrantedAuthoritiesMapper() throws Exception {
    SimpleAuthorityMapper grantedAuthorityMapper = new SimpleAuthorityMapper();
    grantedAuthorityMapper.setPrefix("ROLE_");
    grantedAuthorityMapper.setConvertToUpperCase(true);
    provider.setGrantedAuthoritiesMapper(grantedAuthorityMapper);

    Authentication result = provider.authenticate(token);
    assertEquals(
        Sets.newSet("ROLE_USER", "ROLE_ADMIN"),
        AuthorityUtils.authorityListToSet(result.getAuthorities()));
  }
 @Test
 public void testAuthenticate() throws Exception {
   Authentication result = provider.authenticate(token);
   assertNotNull(result);
   assertEquals(roles, AuthorityUtils.authorityListToSet(result.getAuthorities()));
   assertTrue(result.isAuthenticated());
   assertNotNull(result.getPrincipal());
   assertNotNull(result.getCredentials());
   assertNotNull(result.getDetails());
 }
 @Test
 public void testSupports() throws Exception {
   assertTrue(provider.supports(KeycloakAuthenticationToken.class));
   assertFalse(provider.supports(PreAuthenticatedAuthenticationToken.class));
 }