@Test
    void verifyOperationWithExcludedHandlers() {
        val h1 = getTestOtpAuthenticationHandler();
        val h2 = getSimpleTestAuthenticationHandler();
        val handlers = List.of(h1, getAcceptUsersAuthenticationHandler(), h2);
        val service = CoreAuthenticationTestUtils.getService("https://example.com/high/");
        val authz = getAuthorizer(new ExcludedAuthenticationHandlerAuthenticationPolicy(Set.of(h1.getName(), h2.getName()), false), handlers);
        val map = (Map) Map.of(
            new UsernamePasswordCredential(), getAcceptUsersAuthenticationHandler(),
            getOtpCredential(), h1);
        val assertion = getAssertion(map);
        assertThrows(UnauthorizedServiceException.class, () -> authz.authorize(new MockHttpServletRequest(), service, assertion));
    }
This is {@link AuthenticationPolicyAwareServiceTicketValidationAuthorizerTests}.

@author Misagh Moayyed
@since 6.2.0
core/cas-server-core-validation/src/test/java/org/apereo/cas/validation/AuthenticationPolicyAwareServiceTicketValidationAuthorizerTests.java