@Test
    public void testChangeUserAndPasswordAttributes() {
        val mongoProfileService = new MongoProfileService(getClient(), MongoServer.PASSWORD_ENCODER);
        mongoProfileService.setUsernameAttribute(ALT_USER_ATT);
        mongoProfileService.setPasswordAttribute(ALT_PASS_ATT);
        val objectId = new ObjectId();
        val profile = new MongoProfile();
        profile.setId(MONGO_ID);
        profile.setLinkedId(MONGO_LINKEDID);
        profile.addAttribute(USERNAME, MONGO_USER);
        profile.addAttribute(FIRSTNAME, objectId);
        // create
        mongoProfileService.create(profile, MONGO_PASS);
        // check credentials
        val credentials = new UsernamePasswordCredentials(MONGO_USER, MONGO_PASS);
        mongoProfileService.validate(null, credentials);
        assertNotNull(credentials.getUserProfile());
    }
Tests the {@link MongoProfileService}.

@author Jerome Leleu
@since 1.8.0
pac4j-mongo/src/test/java/org/pac4j/mongo/profile/service/MongoProfileServiceIT.java