}
@org.junit.Test
@org.junit.Ignore
public void testRetrieveClaimsWithUnsupportedOptionalClaimType() throws Exception {
LdapClaimsHandler claimsHandler = (LdapClaimsHandler)appContext.getBean("testClaimsHandler");
String user = props.getProperty("claimUser");
Assert.notNull(user, "Property 'claimUser' not configured");
ClaimCollection requestedClaims = createRequestClaimCollection();
// add unsupported but optional unsupported claim
Claim claim = new Claim();
claim.setClaimType(ClaimTypes.GENDER);
claim.setOptional(true);
requestedClaims.add(claim);
// Gender is not expected to be returned because not supported
List<URI> expectedClaims = new ArrayList<URI>();
expectedClaims.add(ClaimTypes.FIRSTNAME);
expectedClaims.add(ClaimTypes.LASTNAME);
expectedClaims.add(ClaimTypes.EMAILADDRESS);
ClaimsParameters params = new ClaimsParameters();
params.setPrincipal(new CustomTokenPrincipal(user));
ProcessedClaimCollection retrievedClaims =
claimsHandler.retrieveClaimValues(requestedClaims, params);
Assert.isTrue(
retrievedClaims.size() == expectedClaims.size(),
"Retrieved number of claims [" + retrievedClaims.size()
+ "] doesn't match with expected [" + expectedClaims.size() + "]"