@Test
    void verifyOperation() {
        val applicationContext = new StaticApplicationContext();
        applicationContext.refresh();

        val request = new MockHttpServletRequest();
        request.addHeader("headerbypass", "true");
        val props = new MultifactorAuthenticationProviderBypassProperties();
        props.setHttpRequestHeaders("headerbypass");

        val provider = TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext);
        val principal = MultifactorAuthenticationTestUtils.getPrincipal("casuser");
        val authentication = MultifactorAuthenticationTestUtils.getAuthentication(principal);

        val p = new DefaultChainingMultifactorAuthenticationBypassProvider(applicationContext);
        p.addMultifactorAuthenticationProviderBypassEvaluator(
            new HttpRequestMultifactorAuthenticationProviderBypassEvaluator(props, provider.getId(), applicationContext));
        assertFalse(p.isEmpty());
        assertNotNull(p.getId());
        assertNotNull(p.getProviderId());
        assertEquals(1, p.size());

        assertFalse(p.isMultifactorAuthenticationBypassed(authentication, provider.getId()));
        p.rememberBypass(authentication, provider);
        mockRememberBypass(provider, authentication);
        assertTrue(p.isMultifactorAuthenticationBypassed(authentication, provider.getId()));
        when(authentication.getAttributes()).thenReturn(new HashMap<>());
        p.forgetBypass(authentication);
        assertFalse(p.isMultifactorAuthenticationBypassed(authentication, provider.getId()));

        val service = MultifactorAuthenticationTestUtils.getRegisteredService();
        assertFalse(p.shouldMultifactorAuthenticationProviderExecute(authentication, service,
            provider, request, MultifactorAuthenticationTestUtils.getService(service.getServiceId())));

        assertTrue(p.belongsToMultifactorAuthenticationProvider(provider.getId()).isPresent());
        assertFalse(p.filterMultifactorAuthenticationProviderBypassEvaluatorsBy(provider.getId()).isEmpty());
    }
This is {@link DefaultChainingMultifactorAuthenticationBypassProviderTests}.

@author Misagh Moayyed
@since 6.1.0
core/cas-server-core-authentication-mfa-api/src/test/java/org/apereo/cas/authentication/mfa/bypass/DefaultChainingMultifactorAuthenticationBypassProviderTests.java