@Test(expected = AuthenticationException.class) public void testLookUserDummy() { assertNull(userDirectory.lookupUser(UserInfo.Username.valueOf("dummy"))); }
@Override public UserInfo lookupUser(final Username username) { final String usernameString = username.getUsername(); for (UserInfo user : users) { if (user.getUsername().equals(username)) { return user; } } throw new AuthenticationException(format("Username does not exist: {0}", usernameString)); }
DefaultUserDirectory implements UserDirectory { @Override public UserInfo lookupUser(final Username username) { final String usernameString = username.getUsername(); for (UserInfo user : users) { if (user.getUsername().equals(username)) { return user; } } throw new AuthenticationException(format("Username does not exist: {0}", usernameString)); } }
DefaultUserDirectory implements UserDirectory { @Override public UserInfo lookupUser(final Username username) { final String usernameString = username.getUsername(); for (UserInfo user : users) { if (user.getUsername().equals(username)) { return user; } } throw new AuthenticationException(format("Username does not exist: {0}", usernameString)); } @Inject  DefaultUserDirectory(final @Named("authentication.users") List<UserInfo> users); }
DefaultUserDirectory implements UserDirectory { @Override public UserInfo lookupUser(final Username username) { final String usernameString = username.getUsername(); for (UserInfo user : users) { if (user.getUsername().equals(username)) { return user; } } throw new AuthenticationException(format("Username does not exist: {0}", usernameString)); } @Inject  DefaultUserDirectory(final @Named("authentication.users") List<UserInfo> users); @Override UserInfo lookupUserByEmail(final String userEmail); @Override UserInfo lookupUser(final Username username); }
DefaultUserDirectory implements UserDirectory { @Override public UserInfo lookupUser(final Username username) { final String usernameString = username.getUsername(); for (UserInfo user : users) { if (user.getUsername().equals(username)) { return user; } } throw new AuthenticationException(format("Username does not exist: {0}", usernameString)); } @Inject  DefaultUserDirectory(final @Named("authentication.users") List<UserInfo> users); @Override UserInfo lookupUserByEmail(final String userEmail); @Override UserInfo lookupUser(final Username username);  }