@Test
    public void testGetUserProfile() {
        val formClient = getFormClient();
        formClient.setProfileCreator((ctx, credentials) -> {
            var username = ((UsernamePasswordCredentials) credentials).getUsername();
            UserProfile profile = new CommonProfile();
            profile.setId(username);
            profile.addAttribute(Pac4jConstants.USERNAME, username);
            return Optional.of(profile);
        });
        val context = MockWebContext.create();
        val profile = (CommonProfile) formClient.getUserProfile(new CallContext(context, new MockSessionStore()),
            new UsernamePasswordCredentials(USERNAME, USERNAME)).get();
        assertEquals(USERNAME, profile.getId());
        assertEquals(CommonProfile.class.getName() + Pac4jConstants.TYPED_ID_SEPARATOR + USERNAME, profile.getTypedId());
        assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), CommonProfile.class));
        assertEquals(USERNAME, profile.getUsername());
        assertEquals(1, profile.getAttributes().size());
    }
This class tests the {@link DirectFormClient} class.

@author Jerome Leleu
@since 1.8.6
pac4j-http/src/test/java/org/pac4j/http/client/direct/DirectFormClientTests.java