@Test
    void verifyOperation() throws Throwable {
        val requestContext = MockRequestContext.create(applicationContext);
        
        val assertion = mock(Assertion.class);
        val authnStatement = mock(AuthnStatement.class);
        val authnContext = mock(AuthnContext.class);
        val listOfAuthorities = new ArrayList<AuthenticatingAuthority>();
        when(authnContext.getAuthenticatingAuthorities()).thenReturn(listOfAuthorities);
        when(authnStatement.getAuthnContext()).thenReturn(authnContext);
        when(assertion.getAuthnStatements()).thenReturn(List.of(authnStatement));

        val registeredService = new SamlRegisteredService();
        registeredService.setId(RandomUtils.nextInt());
        registeredService.setName("SAML");
        registeredService.setServiceId("https://samltest.id/saml/sp");
        registeredService.setMetadataLocation("https://samltest.id/saml/sp");
        servicesManager.save(registeredService);

        val context = SamlProfileBuilderContext.builder()
            .authenticatedAssertion(Optional.of(AuthenticatedAssertionContext.builder()
                .name("casuser")
                .attributes(Map.of(Pac4jConstants.CLIENT_NAME, "SAML2Client"))
                .build()))
            .registeredService(registeredService)
            .httpRequest(requestContext.getHttpServletRequest())
            .httpResponse(requestContext.getHttpServletResponse())
            .build();

        val builder = mock(Saml20ObjectBuilder.class);
        val authority = mock(AuthenticatingAuthority.class);
        when(builder.newSamlObject(any())).thenReturn(authority);
        assertDoesNotThrow(() -> delegatedSaml2IdPResponseCustomizer.customizeAssertion(context, builder, assertion));
        verify(authority, times(1)).setURI(anyString());
        assertEquals(1, listOfAuthorities.size());
    }
This is {@link DelegatedAuthenticationSamlIdPResponseCustomizerTests}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-pac4j-saml/src/test/java/org/apereo/cas/web/saml2/DelegatedAuthenticationSamlIdPResponseCustomizerTests.java