@Test
    public void shouldForwardRealmRoles() throws CertificateEncodingException, IOException {
        forwardRoles.setActive(true);

        String encoded = generateAndSerializeToken();
        apiRequest.getHeaders().put("Authorization", "Bearer " + encoded);

        keycloakOauthPolicy.apply(apiRequest, mContext, config, mChain);

        @SuppressWarnings("serial")
        Set<String> roles = new HashSet<String>() {
            {
                add("lets-use-a-realm-role");
            }
         };

        verify(mContext).setAttribute(eq(AuthorizationPolicy.AUTHENTICATED_USER_ROLES), eq(roles));
        verify(mChain).doApply(any(ApiRequest.class));
    }
Test the {@link KeycloakOauthPolicy}.

With thanks to the Keycloak project for their RSAVerifierTest whose setup procedures are adapted here for
our requirements.

@author Marc Savy {@literal <msavy@redhat.com>}
plugins/keycloak-oauth-policy/src/test/java/io/apiman/plugins/keycloak_oauth_policy/KeycloakOauthPolicyTest.java