MappingResult<RoleGroup> mappingResult = new MappingResult<RoleGroup>();
Map<String, Object> contextMap = new HashMap<String, Object>();
contextMap.put("token-role-attribute-name", roleAttributeName);
contextMap.put(AbstractSTSLoginModule.SHARED_TOKEN, SAMLUtil.toElement(assertion));
MappingProvider<RoleGroup> mappingProvider = new STSGroupMappingProvider();
mappingProvider.init(contextMap);
mappingProvider.setMappingResult(mappingResult);
mappingProvider.performMapping(contextMap, null);
RoleGroup roleGroup = mappingResult.getMappedObject();
assertNotNull("Unexpected null mapped role", roleGroup);
assertEquals("RoleGroup name has unexpected value", SAML20TokenRoleAttributeProvider.JBOSS_ROLE_PRINCIPAL_NAME,
roleGroup.getRoleName());