@Test
public void shouldCallLoadUserFromServiceWhenCreateUserDetailsIsCalled(){

    User user = getUserForTest();
    Principal principal = mock(Principal.class);
    when(userDetailsService.loadUserByUsername(USERNAME)).thenReturn(principal);
    when(principal.getUser()).thenReturn(user);
    when(principal.getAuthorities()).thenReturn(new GrantedAuthority[1]);
    when(ldapUserDetails.getAttributes()).thenReturn(mock(Attributes.class));
    sut.createUserDetails(ldapUserDetails, USERNAME, PASSWORD);
    verify(userDetailsService).loadUserByUsername(USERNAME);
    verify(ldapUserDetails).isEnabled();
}