private static boolean runGroovyBypassFor(final Authentication authentication) {
        val applicationContext = new StaticApplicationContext();
        applicationContext.refresh();

        val request = new MockHttpServletRequest();
        val properties = new MultifactorAuthenticationProviderBypassProperties();
        properties.getGroovy().setLocation(new ClassPathResource("GroovyBypass.groovy"));
        val provider = new TestMultifactorAuthenticationProvider();
        val groovy = new GroovyMultifactorAuthenticationProviderBypassEvaluator(properties, provider.getId(), applicationContext);

        val registeredService = mock(RegisteredService.class);
        when(registeredService.getName()).thenReturn("Service");
        when(registeredService.getServiceId()).thenReturn("http://app.org");
        when(registeredService.getId()).thenReturn(1000L);

        ApplicationContextProvider.holdApplicationContext(applicationContext);
        ApplicationContextProvider.registerBeanIntoApplicationContext(applicationContext,
            MultifactorAuthenticationPrincipalResolver.identical(), UUID.randomUUID().toString());

        return groovy.shouldMultifactorAuthenticationProviderExecute(authentication, registeredService, provider, request, mock(Service.class));
    }
This is {@link GroovyMultifactorAuthenticationProviderBypassEvaluatorTests}.

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