@Test
    public void validateInvalidAttributeConversion() {
        val credentials = createCredentialsForTest(false, true);
        final Map<String, String> mappedAttributes = createMappedAttributesForTest();

        val authenticator = new SAML2Authenticator(null, null, "username", mappedAttributes);
        authenticator.init();
        authenticator.buildProfile(credentials);

        val finalProfile = credentials.getUserProfile();
        authenticator.getProfileDefinition().convertAndAdd(credentials.getUserProfile(), PROFILE_ATTRIBUTE, CommonProfileDefinition.GENDER,
            List.of("invalid"));
        authenticator.getProfileDefinition().convertAndAdd(credentials.getUserProfile(), PROFILE_ATTRIBUTE, CommonProfileDefinition.LOCALE,
            List.of(1L));
        authenticator.getProfileDefinition().convertAndAdd(credentials.getUserProfile(), PROFILE_ATTRIBUTE,
            CommonProfileDefinition.PICTURE_URL, List.of("invalid"));
        authenticator.getProfileDefinition().convertAndAdd(credentials.getUserProfile(), PROFILE_ATTRIBUTE,
            CommonProfileDefinition.PROFILE_URL, List.of("invalid"));

        assertTrue(finalProfile instanceof SAML2Profile);
        var samlProfile = (SAML2Profile)finalProfile;

        assertEquals(Gender.UNSPECIFIED, samlProfile.getGender());
        assertNull(samlProfile.getLocale());
        assertNotNull(samlProfile.getPictureUrl());
        assertEquals("invalid", samlProfile.getPictureUrl().toString());
        assertNotNull(samlProfile.getProfileUrl());
        assertEquals("invalid", samlProfile.getProfileUrl().toString());
    }
This is {@link SAML2AuthenticatorTests}.
@author Misagh Moayyed
pac4j-saml/src/test/java/org/pac4j/saml/credentials/authenticator/SAML2AuthenticatorTests.java