@Test
    void verifyAction() {
        assertFalse(surrogateAuthenticationMetadataPopulator.supports(CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword()));

        val credential = new UsernamePasswordCredential();
        credential.getCredentialMetadata().addTrait(new SurrogateCredentialTrait("cassurrogate"));
        credential.setUsername("casuser");
        credential.assignPassword("password");

        val builder = CoreAuthenticationTestUtils.getAuthenticationBuilder();
        assertThrows(SurrogateAuthenticationException.class,
            () -> surrogateAuthenticationMetadataPopulator.populateAttributes(builder, mock(AuthenticationTransaction.class)));
        surrogateAuthenticationMetadataPopulator.populateAttributes(builder,
            CoreAuthenticationTestUtils.getAuthenticationTransactionFactory().newTransaction(credential));
        val authentication = builder.build();
        assertTrue(authentication.containsAttribute(SurrogateAuthenticationService.AUTHENTICATION_ATTR_SURROGATE_ENABLED));
        assertTrue(authentication.containsAttribute(SurrogateAuthenticationService.AUTHENTICATION_ATTR_SURROGATE_PRINCIPAL));
        assertTrue(authentication.containsAttribute(SurrogateAuthenticationService.AUTHENTICATION_ATTR_SURROGATE_USER));

    }
This is {@link SurrogateAuthenticationMetaDataPopulatorTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-surrogate-authentication/src/test/java/org/apereo/cas/authentication/SurrogateAuthenticationMetaDataPopulatorTests.java