@Test
public void build_AnyParameters_InjectInsideCasAuthenticationProvider() {

    String key = "key";
    AuthenticationUserDetailsService userDetailsService = Mockito.mock(AuthenticationUserDetailsService.class);
    GrantedAuthoritiesMapper grantedAuthoritiesMapper = Mockito.mock(GrantedAuthoritiesMapper.class);
    MessageSource messageSource = Mockito.mock(MessageSource.class);
    StatelessTicketCache statelessTicketCache = Mockito.mock(StatelessTicketCache.class);
    TicketValidator ticketValidator = Mockito.mock(TicketValidator.class);
    builder.key(key)
           .authenticationUserDetailsService(userDetailsService)
           .grantedAuthoritiesMapper(grantedAuthoritiesMapper)
           .messageSource(messageSource)
           .statelessTicketCache(statelessTicketCache)
           .ticketValidator(ticketValidator);
    assertThat(builder.build())
            .extracting("key", "authenticationUserDetailsService", "authoritiesMapper", "statelessTicketCache",
                    "ticketValidator")
            .usingElementComparator((Comparator<Object>) (o1, o2) -> (o1 == o2) ? 0 : -1)
            .containsOnly(key, userDetailsService, grantedAuthoritiesMapper, statelessTicketCache, ticketValidator);
    assertThat(builder.build()).hasFieldOrPropertyWithValue("messages.messageSource", messageSource);
}