@Test
        void verifyMismatchAttributesMustDeny() {
            val policy = mock(RegisteredServiceMultifactorPolicy.class);
            when(policy.getPrincipalAttributeNameTrigger()).thenReturn("bad-attribute");
            when(policy.getPrincipalAttributeValueToMatch()).thenReturn(".+@example.*");
            when(policy.getMultifactorAuthenticationProviders()).thenReturn(Set.of(TestMultifactorAuthenticationProvider.ID));
            val registeredService = CoreAuthenticationTestUtils.getRegisteredService();
            when(registeredService.getMultifactorAuthenticationPolicy()).thenReturn(policy);
            assertThrows(AuthenticationException.class,
                () -> registeredServicePrincipalAttributeMultifactorAuthenticationTrigger.isActivated(
                    CoreAuthenticationTestUtils.getAuthentication(), registeredService,
                    new MockHttpServletRequest(), new MockHttpServletResponse(),
                    CoreAuthenticationTestUtils.getService()));
        }
This is {@link RegisteredServicePrincipalAttributeMultifactorAuthenticationTriggerTests}.

@author Misagh Moayyed
@since 6.1.0
core/cas-server-core-authentication-mfa/src/test/java/org/apereo/cas/authentication/mfa/trigger/RegisteredServicePrincipalAttributeMultifactorAuthenticationTriggerTests.java