@Test
    void verifyCredentialFound() throws Throwable {
        val context = MockRequestContext.create(applicationContext);
        WebUtils.putCredential(context, CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword("casuser"));

        val builder = mock(AuthenticationResultBuilder.class);
        when(builder.getInitialAuthentication()).thenReturn(Optional.of(CoreAuthenticationTestUtils.getAuthentication("casuser")));
        when(builder.collect(any(Authentication.class))).thenReturn(builder);

        WebUtils.putAuthenticationResultBuilder(builder, context);
        context.setParameter(SurrogateSelectionAction.PARAMETER_NAME_SURROGATE_TARGET, "cassurrogate");
        assertEquals(CasWebflowConstants.TRANSITION_ID_SUCCESS, selectSurrogateAction.execute(context).getId());
    }
This is {@link SurrogateSelectionActionTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-surrogate-webflow/src/test/java/org/apereo/cas/web/flow/action/SurrogateSelectionActionTests.java