@Test
public void authenticate_EveryRequirements_TicketValidatorProxyCallbackUrlUpdated() {

    Cas20ServiceTicketValidator ticketValidator = mock(Cas20ServiceTicketValidator.class);
    DynamicProxyCallbackUrlCasAuthenticationProvider authenticationProvider =
            new DynamicProxyCallbackUrlCasAuthenticationProvider();
    authenticationProvider.setTicketValidator(ticketValidator);
    when(authentication.getDetails()).thenReturn(new ProxyCallbackAndServiceAuthenticationDetails() {
        private static final long serialVersionUID = -541835714542292545L;
        @Override
        public String getServiceUrl() {
            return "http://localhost";
        }
        @Override
        public String getProxyCallbackUrl() {
            return "http://localhost/cas/callback";
        }
        @Override
        public void setContext(HttpServletRequest context) {
            // do nothing
        }
    });
    doNothing().when(ticketValidator).setProxyCallbackUrl(anyString());
    authenticationProvider.authenticate(authentication);
    verify(authentication, times(2)).getDetails();
    verify(ticketValidator, times(1)).setProxyCallbackUrl(eq("http://localhost/cas/callback"));
}