protected void verifyFetchingPolicy(final RegisteredService service,
                                        final Authentication authentication, final boolean expectPolicyFound) throws Exception {
        val context = MockRequestContext.create();
        val flowDefinition = mock(Flow.class);
        when(flowDefinition.getApplicationContext()).thenReturn(applicationContext);
        context.setActiveFlow(flowDefinition);

        WebUtils.putRegisteredService(context, service);
        WebUtils.putAuthentication(authentication, context);
        assertEquals(expectPolicyFound, getAcceptableUsagePolicyRepository().fetchPolicy(context).isPresent());
    }
Repository can update the state of the AUP acceptance without reloading the principal. Mostly for testing purposes.

@return live updates are possible.
support/cas-server-support-aup-webflow/src/test/java/org/apereo/cas/aup/BaseAcceptableUsagePolicyRepositoryTests.java