public static RequestedAuthenticationContextValidator mockRequestAuthnContextValidator(
        final ServicesManager servicesManager,
        final Optional<MultifactorAuthenticationProvider> provider,
        final ConfigurableApplicationContext applicationContext,
        final String failureMode) throws Throwable {
        val multifactorTrigger = mock(MultifactorAuthenticationTriggerSelectionStrategy.class);

        val service = MultifactorAuthenticationTestUtils.getRegisteredService("https://www.github.com/apereo/cas", failureMode);
        when(servicesManager.findServiceBy(any(Service.class))).thenReturn(service);
        when(multifactorTrigger.resolve(any(), any(), any(), any(), any())).thenReturn(provider);

        val multifactorContextValidator = new DefaultMultifactorAuthenticationContextValidator(
            "authn_method", "trusted_authn", applicationContext);
        return new DefaultRequestedAuthenticationContextValidator(servicesManager,
            multifactorTrigger, multifactorContextValidator);
    }
This is {@link MultifactorAuthenticationTestUtils}.

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