private void internalTestRestBasic(final CasRestBasicAuthClient client, int nbAttributes) {
        val context = MockWebContext.create();
        val token = USER + ":" + USER;
        context.addRequestHeader(VALUE, NAME + Base64.getEncoder().encodeToString(token.getBytes(StandardCharsets.UTF_8)));

        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());
        assertEquals(nbAttributes, casProfile.getAttributes().size());
        client.destroyTicketGrantingTicket(profile, context);

        TestsHelper.expectException(() -> client.requestServiceTicket(PAC4J_BASE_URL, profile, context), TechnicalException.class,
                "Service ticket request for `#CasRestProfile# | id: " + USER + " | attributes: {} | roles: [] | "
                    + "isRemembered: false | clientName: CasRestBasicAuthClient | linkedId: null |` failed: (404) Not Found");
    }
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