@Test
    void verifySuccess() throws Throwable {
        val credential = CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword(
            "casuser@apereo.org", "a8BuQH@6B7z");
        val response = mock(AuthenticationResponse.class);

        val user = mock(User.class);
        when(user.getLogin()).thenReturn("casuser");
        when(user.getId()).thenReturn("casuser");
        when(response.getUser()).thenReturn(user);
        when(response.getSessionToken()).thenReturn("token");
        val client = mock(AuthenticationClient.class);
        when(client.authenticate(anyString(), any(), any(), any(AuthenticationStateHandler.class)))
            .thenAnswer(invocationOnMock -> {
                val adapter = invocationOnMock.getArgument(3, AuthenticationStateHandler.class);
                adapter.handleSuccess(response);
                return response;
            });
        val handler = new OktaAuthenticationHandler(null, servicesManager,
            oktaPrincipalFactory, casProperties.getAuthn().getOkta(), client);
        assertNotNull(handler.authenticate(credential, mock(Service.class)));
        assertNotNull(handler.getOktaAuthenticationClient());
        assertNotNull(handler.getProperties());
    }
This is {@link OktaAuthenticationStateHandlerTests}.

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