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

        val casProperties = new CasConfigurationProperties();
        casProperties.getAuthn().getMfa().getCore()
            .setGlobalFailureMode(BaseMultifactorAuthenticationProviderProperties.MultifactorAuthenticationProviderFailureModes.OPEN);
        val failureEvaluator = new DefaultMultifactorAuthenticationFailureModeEvaluator(casProperties);
        val chainProvider = new DefaultChainingMultifactorAuthenticationProvider(applicationContext, failureEvaluator);

        val provider1 = new TestMultifactorAuthenticationProvider("mfa-first");
        provider1.setOrder(10);
        val provider2 = new TestMultifactorAuthenticationProvider("mfa-second");
        provider2.setOrder(20);

        chainProvider.addMultifactorAuthenticationProvider(provider1);
        chainProvider.addMultifactorAuthenticationProvider(provider2);
        TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext, chainProvider);
        TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext, provider1);
        TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext, provider2);

        val v = new DefaultMultifactorAuthenticationContextValidator("authn_method",
            "trusted_authn", applicationContext);
        val authentication = MultifactorAuthenticationTestUtils.getAuthentication(
            MultifactorAuthenticationTestUtils.getPrincipal("casuser"),
            CollectionUtils.wrap("authn_method", List.of(provider2.getId())));
        val result = v.validate(authentication, provider2.getId(),
            Optional.of(MultifactorAuthenticationTestUtils.getRegisteredService()));
        assertTrue(result.isSuccess());
    }
This is {@link DefaultMultifactorAuthenticationContextValidatorTests}.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-authentication-mfa-api/src/test/java/org/apereo/cas/authentication/mfa/DefaultMultifactorAuthenticationContextValidatorTests.java