private void internalTestRestForm(final Authenticator authenticator) {
        val client = new CasRestFormClient();
        client.setConfiguration(getConfig());
        client.setAuthenticator(authenticator);

        val context = MockWebContext.create();
        context.addRequestParameter(client.getUsernameParameter(), USER);
        context.addRequestParameter(client.getPasswordParameter(), USER);

        val credentials =
            (UsernamePasswordCredentials) client.getCredentials(new CallContext(context, new MockSessionStore())).get();
        val profile = (CasRestProfile) client.getUserProfile(new CallContext(context, new MockSessionStore()), credentials).get();
        assertEquals(USER, profile.getId());
        assertNotNull(profile.getTicketGrantingTicketId());

        val casCreds = client.requestServiceTicket(PAC4J_BASE_URL, profile, context);
        val casProfile = client.validateServiceTicket(PAC4J_BASE_URL, casCreds, context);
        assertNotNull(casProfile);
        assertEquals(USER, casProfile.getId());
        assertTrue(casProfile.getAttributes().size() > 0);
    }
Tests the {@link CasRestBasicAuthClient} and {@link CasRestFormClient}.

@author Misagh Moayyed
@since 1.8.0
pac4j-cas/src/test/java/org/pac4j/cas/client/rest/CasRestClientIT.java