@Test
    void verifyMultiPrincipalsWithNoAttributes() throws Throwable {
        val strategy = new SurrogatePrincipalElectionStrategy();
        val attributes = CollectionUtils.<String, List<Object>>wrap(
            "primaryName1", CollectionUtils.wrapList("cas"),
            "primaryName2", CollectionUtils.wrapList("user"));

        val principals = new ArrayList<Principal>();
        val primaryPrincipal1 = CoreAuthenticationTestUtils.getPrincipal("primary", new HashMap<>());
        principals.add(primaryPrincipal1);

        val credential = new BasicIdentifiableCredential();
        credential.getCredentialMetadata()
            .addTrait(new SurrogateCredentialTrait("cas-surrogate"));
        val surrogatePrincipal = buildSurrogatePrincipal(credential,
            CoreAuthenticationTestUtils.getAuthentication(primaryPrincipal1));
        principals.add(surrogatePrincipal);

        val primaryPrincipal2 = CoreAuthenticationTestUtils.getPrincipal("primary", attributes);
        principals.add(primaryPrincipal2);

        val principal = (SurrogatePrincipal) strategy.nominate(principals, Map.of());
        assertNotNull(principal);
        assertEquals("cas-surrogate", principal.getId());
        assertEquals(6, principal.getAttributes().size());
        assertEquals("primary", principal.getPrimary().getId());
        assertEquals(attributes, principal.getPrimary().getAttributes());
    }
This is {@link SurrogatePrincipalElectionStrategyTests}.

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