@Test
    void verifyUsernamePasswordCredentialsFound() throws Throwable {
        val context = MockRequestContext.create(applicationContext);
        val c = new UsernamePasswordCredential();
        c.setUsername("cassurrogate+casuser");
        c.assignPassword("Mellon");
        WebUtils.putCredential(context, c);
        assertNull(initialAuthenticationAction.execute(context));
        assertFalse(WebUtils.hasSurrogateAuthenticationRequest(context));
        val credential = WebUtils.getCredential(context);
        assertEquals("casuser", credential.getId());
        assertEquals("cassurrogate", credential.getCredentialMetadata()
            .getTrait(SurrogateCredentialTrait.class).get().getSurrogateUsername());
    }
This is {@link SurrogateInitialAuthenticationActionTests}.

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