@Test void willLoadUserByUsername() { when(usersReadService.getUserByUsername(USER_NAME)).thenReturn(USER); UserDetails userDetails = appUserDetailsService.loadUserByUsername(USER_NAME); assertEquals(new AppUserDetails(USER), userDetails); }
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user; try { user = usersReadService.getUserByUsername(username); } catch (NoSuchElementException e) { throw new UsernameNotFoundException("Invalid credentials", e); } return new AppUserDetails(user); }
AppUserDetailsService implements ApplicationUserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user; try { user = usersReadService.getUserByUsername(username); } catch (NoSuchElementException e) { throw new UsernameNotFoundException("Invalid credentials", e); } return new AppUserDetails(user); } }
AppUserDetailsService implements ApplicationUserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user; try { user = usersReadService.getUserByUsername(username); } catch (NoSuchElementException e) { throw new UsernameNotFoundException("Invalid credentials", e); } return new AppUserDetails(user); } AppUserDetailsService(UsersReadService usersReadService); }
AppUserDetailsService implements ApplicationUserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user; try { user = usersReadService.getUserByUsername(username); } catch (NoSuchElementException e) { throw new UsernameNotFoundException("Invalid credentials", e); } return new AppUserDetails(user); } AppUserDetailsService(UsersReadService usersReadService); @Override UserDetails loadUserByUsername(String username); }
AppUserDetailsService implements ApplicationUserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user; try { user = usersReadService.getUserByUsername(username); } catch (NoSuchElementException e) { throw new UsernameNotFoundException("Invalid credentials", e); } return new AppUserDetails(user); } AppUserDetailsService(UsersReadService usersReadService); @Override UserDetails loadUserByUsername(String username);  }