@Test(expectedExceptions = UsernameNotFoundException.class) public void shouldFailToLoadByUsernameWhenUserNotExists() { service.loadUserByUsername("name"); }
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = repository.findOne(username); if (user == null) { throw new UsernameNotFoundException(username); } return user; }
MongoUserDetailsService implements UserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = repository.findOne(username); if (user == null) { throw new UsernameNotFoundException(username); } return user; } }
MongoUserDetailsService implements UserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = repository.findOne(username); if (user == null) { throw new UsernameNotFoundException(username); } return user; }  }
MongoUserDetailsService implements UserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = repository.findOne(username); if (user == null) { throw new UsernameNotFoundException(username); } return user; }  @Override UserDetails loadUserByUsername(String username); }
MongoUserDetailsService implements UserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = repository.findOne(username); if (user == null) { throw new UsernameNotFoundException(username); } return user; }  @Override UserDetails loadUserByUsername(String username);  }