@Test
    void verifyOperation() throws Throwable {
        val uid = "casuser";
        val builder = new DefaultAuthenticationResultBuilder(principalElectionStrategy)
            .collect(CoreAuthenticationTestUtils.getAuthentication(uid));
        val account = PasswordlessUserAccount.builder().username(uid).build();

        val credential = new BasicIdentifiableCredential(uid);
        val service = RegisteredServiceTestUtils.getService(UUID.randomUUID().toString());
        servicesManager.save(RegisteredServiceTestUtils.getRegisteredService(service.getId(), Map.of()));

        val results = surrogatePasswordlessAuthenticationPreProcessor.process(builder, account,
            service, credential,
            PasswordlessAuthenticationToken.builder().username(uid).build().property("surrogateUsername", "cassurrogate"));
        assertTrue(credential.getCredentialMetadata().getTrait(SurrogateCredentialTrait.class).isPresent());
        val authns = new ArrayList<>(results.getAuthentications());
        assertInstanceOf(SimplePrincipal.class, authns.getFirst().getPrincipal());
        assertInstanceOf(SurrogatePrincipal.class, authns.get(1).getPrincipal());
    }
This is {@link SurrogatePasswordlessAuthenticationPreProcessorTests}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-surrogate-webflow/src/test/java/org/apereo/cas/web/flow/passwordless/SurrogatePasswordlessAuthenticationPreProcessorTests.java