@Test(expected = UsernameNotFoundException.class) public void test_loadUserByUsername_notFound() { adminDetailsServiceToTest.loadUserByUsername("notExisting"); }
@Override public UserDetails loadUserByUsername(String arg0) throws UsernameNotFoundException { String userData = users.getProperty(arg0); if (userData == null) { throw new UsernameNotFoundException("User could not be found in user file."); } String[] data = userData.split(","); if (data.length < 3) { throw new UsernameNotFoundException("The userdata is incomplete."); } List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>(); roles.add(new GilesGrantedAuthority(data[1])); UserDetails details = new User(arg0, data[0], data[2].equals("enabled"), true, true, true, roles); return details; }
AdminUserDetailsService implements IAdminUserDetailsService { @Override public UserDetails loadUserByUsername(String arg0) throws UsernameNotFoundException { String userData = users.getProperty(arg0); if (userData == null) { throw new UsernameNotFoundException("User could not be found in user file."); } String[] data = userData.split(","); if (data.length < 3) { throw new UsernameNotFoundException("The userdata is incomplete."); } List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>(); roles.add(new GilesGrantedAuthority(data[1])); UserDetails details = new User(arg0, data[0], data[2].equals("enabled"), true, true, true, roles); return details; } }
AdminUserDetailsService implements IAdminUserDetailsService { @Override public UserDetails loadUserByUsername(String arg0) throws UsernameNotFoundException { String userData = users.getProperty(arg0); if (userData == null) { throw new UsernameNotFoundException("User could not be found in user file."); } String[] data = userData.split(","); if (data.length < 3) { throw new UsernameNotFoundException("The userdata is incomplete."); } List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>(); roles.add(new GilesGrantedAuthority(data[1])); UserDetails details = new User(arg0, data[0], data[2].equals("enabled"), true, true, true, roles); return details; }  }
AdminUserDetailsService implements IAdminUserDetailsService { @Override public UserDetails loadUserByUsername(String arg0) throws UsernameNotFoundException { String userData = users.getProperty(arg0); if (userData == null) { throw new UsernameNotFoundException("User could not be found in user file."); } String[] data = userData.split(","); if (data.length < 3) { throw new UsernameNotFoundException("The userdata is incomplete."); } List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>(); roles.add(new GilesGrantedAuthority(data[1])); UserDetails details = new User(arg0, data[0], data[2].equals("enabled"), true, true, true, roles); return details; }  @PostConstruct void init(); @Override UserDetails loadUserByUsername(String arg0); @Override List<UserDetails> getAllAdmins(); @Override boolean changePassword(String username, String password); @Override boolean isPasswordValid(String username, String password); }
AdminUserDetailsService implements IAdminUserDetailsService { @Override public UserDetails loadUserByUsername(String arg0) throws UsernameNotFoundException { String userData = users.getProperty(arg0); if (userData == null) { throw new UsernameNotFoundException("User could not be found in user file."); } String[] data = userData.split(","); if (data.length < 3) { throw new UsernameNotFoundException("The userdata is incomplete."); } List<GrantedAuthority> roles = new ArrayList<GrantedAuthority>(); roles.add(new GilesGrantedAuthority(data[1])); UserDetails details = new User(arg0, data[0], data[2].equals("enabled"), true, true, true, roles); return details; }  @PostConstruct void init(); @Override UserDetails loadUserByUsername(String arg0); @Override List<UserDetails> getAllAdmins(); @Override boolean changePassword(String username, String password); @Override boolean isPasswordValid(String username, String password);  }