@Test
    void handleSuccess() {
        val adapter = new OktaAuthenticationStateHandlerAdapter(
            new DefaultPasswordPolicyHandlingStrategy<>(), new PasswordPolicyContext());
        val response = mock(AuthenticationResponse.class);
        when(response.getSessionToken()).thenReturn("token");
        when(response.getStatusString()).thenReturn("error");
        val user = mock(User.class);
        when(user.getLogin()).thenReturn("cas");
        when(user.getId()).thenReturn("cas-id");
        when(user.getProfile()).thenReturn(Map.of("name", "something", "lastName", "something-else"));
        when(response.getUser()).thenReturn(user);
        adapter.handleSuccess(response);
        assertDoesNotThrow(adapter::throwExceptionIfNecessary);
        assertEquals("cas", adapter.getUsername());
        assertFalse(adapter.getUserAttributes().isEmpty());
    }
This is {@link OktaAuthenticationStateHandlerAdapterTests}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-okta-authentication/src/test/java/org/apereo/cas/okta/OktaAuthenticationStateHandlerAdapterTests.java