@Test
    void verifyResolverWithNoAttributes() throws Throwable {
        val context = getPrincipalResolutionContext(StringUtils.EMPTY, mock(PersonAttributeDao.class));
        val surrogatePrincipalBuilder = getBuilder();
        val resolver = new SurrogatePrincipalResolver(context);
        resolver.setSurrogatePrincipalBuilder(surrogatePrincipalBuilder);
        val credential = new UsernamePasswordCredential();
        val surrogateTrait = new SurrogateCredentialTrait("surrogate");
        credential.getCredentialMetadata().addTrait(surrogateTrait);
        credential.setUsername("test");
        val principal = resolver.resolve(credential, Optional.of(CoreAuthenticationTestUtils.getPrincipal("test")),
            Optional.of(mock(AuthenticationHandler.class)), Optional.of(CoreAuthenticationTestUtils.getService()));
        assertInstanceOf(SurrogatePrincipal.class, principal);
        assertEquals(principal.getId(), surrogateTrait.getSurrogateUsername());
    }
This is {@link SurrogatePrincipalResolverTests}.

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