### Question:
PropertiesBasedRoleMapper implements RoleMappingsProvider { @Override public Set<String> map(final String principalName, final Set<String> roles) { if (this.roleMappings == null || this.roleMappings.isEmpty()) return roles; Set<String> resolvedRoles = new HashSet<>(); for (String role : roles) { if (this.roleMappings.containsKey(role)) { this.extractRolesIntoSet(role, resolvedRoles); } else { resolvedRoles.add(role); } } if (this.roleMappings.containsKey(principalName)) { this.extractRolesIntoSet(principalName, resolvedRoles); } return resolvedRoles; }  @Override String getId(); @Override void init(final SamlDeployment deployment, final ResourceLoader loader, final Properties config); @Override Set<String> map(final String principalName, final Set<String> roles); static final String PROVIDER_ID; }### Answer:
@Test public void testPropertiesBasedRoleMapper() throws Exception { InputStream is = getClass().getResourceAsStream("config/parsers/keycloak-saml-with-role-mappings-provider.xml"); SamlDeployment deployment = new DeploymentBuilder().build(is, new ResourceLoader() { @Override public InputStream getResourceAsStream(String resource) { return this.getClass().getClassLoader().getResourceAsStream(resource); } }); RoleMappingsProvider provider = deployment.getRoleMappingsProvider(); final Set<String> samlRoles = new HashSet<>(Arrays.asList(new String[]{"samlRoleA", "samlRoleB", "samlRoleC"})); final Set<String> mappedRoles = provider.map("kc-user", samlRoles); assertNotNull(mappedRoles); assertEquals(4, mappedRoles.size()); Set<String> expectedRoles = new HashSet<>(Arrays.asList(new String[]{"samlRoleC", "jeeRoleX", "jeeRoleY", "jeeRoleZ"})); assertEquals(expectedRoles, mappedRoles); }