@Test public void testLookupByEmailSuccess() { assertNotNull(userDirectory.lookupUserByEmail("admin@example.com")); assertNotNull(userDirectory.lookupUserByEmail("wasabi_writer@example.com")); assertNotNull(userDirectory.lookupUserByEmail("wasabi_admin@example.com")); assertNotNull(userDirectory.lookupUserByEmail("wasabi_reader@example.com")); }
@Override public UserInfo lookupUserByEmail(final String userEmail) { for (UserInfo user : users) { if (user.getEmail().equals(userEmail)) { return user; } } throw new AuthenticationException(format("Email address does not exist: {0}", userEmail)); }
DefaultUserDirectory implements UserDirectory { @Override public UserInfo lookupUserByEmail(final String userEmail) { for (UserInfo user : users) { if (user.getEmail().equals(userEmail)) { return user; } } throw new AuthenticationException(format("Email address does not exist: {0}", userEmail)); } }
DefaultUserDirectory implements UserDirectory { @Override public UserInfo lookupUserByEmail(final String userEmail) { for (UserInfo user : users) { if (user.getEmail().equals(userEmail)) { return user; } } throw new AuthenticationException(format("Email address does not exist: {0}", userEmail)); } @Inject  DefaultUserDirectory(final @Named("authentication.users") List<UserInfo> users); }
DefaultUserDirectory implements UserDirectory { @Override public UserInfo lookupUserByEmail(final String userEmail) { for (UserInfo user : users) { if (user.getEmail().equals(userEmail)) { return user; } } throw new AuthenticationException(format("Email address does not exist: {0}", userEmail)); } @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 lookupUserByEmail(final String userEmail) { for (UserInfo user : users) { if (user.getEmail().equals(userEmail)) { return user; } } throw new AuthenticationException(format("Email address does not exist: {0}", userEmail)); } @Inject  DefaultUserDirectory(final @Named("authentication.users") List<UserInfo> users); @Override UserInfo lookupUserByEmail(final String userEmail); @Override UserInfo lookupUser(final Username username);  }