@Test public void testMapUserFromContext() { final UserDetailsServiceImpl svc = context.mock(UserDetailsServiceImpl.class); final UserDetailsChecker udc = context.mock(UserDetailsChecker.class); final UserDetails ud = context.mock(UserDetails.class); context.checking(new Expectations() { { oneOf(svc).loadUserByUsername(with("username")); will(returnValue(ud)); oneOf(udc).check(ud); } }); UserDetailsContextMapperImpl sut = new UserDetailsContextMapperImpl(svc); sut.setDetailsChecker(udc); sut.mapUserFromContext(null, "username", null); context.assertIsSatisfied(); }
public UserDetails mapUserFromContext(final DirContextOperations context, final String username, final GrantedAuthority[] authority) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); detailsChecker.check(userDetails); return userDetails; }
UserDetailsContextMapperImpl implements UserDetailsContextMapper { public UserDetails mapUserFromContext(final DirContextOperations context, final String username, final GrantedAuthority[] authority) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); detailsChecker.check(userDetails); return userDetails; } }
UserDetailsContextMapperImpl implements UserDetailsContextMapper { public UserDetails mapUserFromContext(final DirContextOperations context, final String username, final GrantedAuthority[] authority) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); detailsChecker.check(userDetails); return userDetails; } UserDetailsContextMapperImpl(
            final UserDetailsService inUserDetailsService); }
UserDetailsContextMapperImpl implements UserDetailsContextMapper { public UserDetails mapUserFromContext(final DirContextOperations context, final String username, final GrantedAuthority[] authority) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); detailsChecker.check(userDetails); return userDetails; } UserDetailsContextMapperImpl(
            final UserDetailsService inUserDetailsService); UserDetails mapUserFromContext(final DirContextOperations context,
            final String username, final GrantedAuthority[] authority); void mapUserToContext(final UserDetails userDetails,
            final DirContextAdapter context); void setDetailsChecker(final UserDetailsChecker inDetailsChecker); }
UserDetailsContextMapperImpl implements UserDetailsContextMapper { public UserDetails mapUserFromContext(final DirContextOperations context, final String username, final GrantedAuthority[] authority) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); detailsChecker.check(userDetails); return userDetails; } UserDetailsContextMapperImpl(
            final UserDetailsService inUserDetailsService); UserDetails mapUserFromContext(final DirContextOperations context,
            final String username, final GrantedAuthority[] authority); void mapUserToContext(final UserDetails userDetails,
            final DirContextAdapter context); void setDetailsChecker(final UserDetailsChecker inDetailsChecker);  }