@Test
    void verifyActionGeoLocationRejected() throws Throwable {
        val context = MockRequestContext.create();
        context.setRemoteAddr("185.86.151.11").setLocalAddr("185.88.151.11").withUserAgent(USER_AGENT).setClientInfo();

        val geoRequest = new GeoLocationRequest(51.5, -0.118);
        val props = new AdaptiveAuthenticationProperties();
        props.getPolicy().setRejectCountries("UK");
        val service = mock(GeoLocationService.class);
        val response = new GeoLocationResponse();
        response.addAddress("UK");
        response.setLatitude(Double.parseDouble(geoRequest.getLatitude()));
        response.setLongitude(Double.parseDouble(geoRequest.getLongitude()));
        when(service.locate(anyString(), any())).thenReturn(response);
        val p = new DefaultAdaptiveAuthenticationPolicy(service, IPAddressIntelligenceService.allowed(), props);
        assertFalse(p.isAuthenticationRequestAllowed(context, USER_AGENT, geoRequest));
    }
This is {@link DefaultAdaptiveAuthenticationPolicyTests}.

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