public static RegisteredService getRegisteredService(final String url, final String failureMode) {
        val service = mock(RegisteredService.class);
        when(service.getServiceId()).thenReturn(url);
        when(service.getName()).thenReturn("CAS");
        when(service.getId()).thenReturn(Long.MAX_VALUE);
        when(service.getDescription()).thenReturn("Apereo CAS");
        val access = mock(RegisteredServiceAccessStrategy.class);
        when(access.isServiceAccessAllowed(service, mock(Service.class))).thenReturn(true);
        when(service.getAccessStrategy()).thenReturn(access);
        val mfaPolicy = mock(RegisteredServiceMultifactorPolicy.class);
        when(mfaPolicy.isBypassEnabled()).thenReturn(false);
        when(mfaPolicy.getFailureMode())
            .thenReturn(BaseMultifactorAuthenticationProviderProperties.MultifactorAuthenticationProviderFailureModes.valueOf(failureMode));
        when(service.getMultifactorAuthenticationPolicy()).thenReturn(mfaPolicy);
        return service;
    }
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