@Test public void getUserFromPersistentIdReturnsEmptyWhenTheIdIsNull() throws Exception { Optional<User> user = basicUserValidator.getUserFromPersistentId(null); assertThat(user, is(Optional.empty())); }
@Override public Optional<User> getUserFromPersistentId(String persistentId) throws UserValidationException { if (persistentId == null) { return Optional.empty(); } try { return userStore.userFor(persistentId); } catch (AuthenticationUnavailableException e) { throw new UserValidationException(e); } }
BasicUserValidator implements UserValidator { @Override public Optional<User> getUserFromPersistentId(String persistentId) throws UserValidationException { if (persistentId == null) { return Optional.empty(); } try { return userStore.userFor(persistentId); } catch (AuthenticationUnavailableException e) { throw new UserValidationException(e); } } }
BasicUserValidator implements UserValidator { @Override public Optional<User> getUserFromPersistentId(String persistentId) throws UserValidationException { if (persistentId == null) { return Optional.empty(); } try { return userStore.userFor(persistentId); } catch (AuthenticationUnavailableException e) { throw new UserValidationException(e); } } BasicUserValidator(UserStore userStore, LoggedInUsers loggedInUsers); }
BasicUserValidator implements UserValidator { @Override public Optional<User> getUserFromPersistentId(String persistentId) throws UserValidationException { if (persistentId == null) { return Optional.empty(); } try { return userStore.userFor(persistentId); } catch (AuthenticationUnavailableException e) { throw new UserValidationException(e); } } BasicUserValidator(UserStore userStore, LoggedInUsers loggedInUsers); @Override Optional<User> getUserFromAccessToken(String accessToken); @Override Optional<User> getUserFromUserId(String userId); @Override Optional<User> getUserFromPersistentId(String persistentId); }
BasicUserValidator implements UserValidator { @Override public Optional<User> getUserFromPersistentId(String persistentId) throws UserValidationException { if (persistentId == null) { return Optional.empty(); } try { return userStore.userFor(persistentId); } catch (AuthenticationUnavailableException e) { throw new UserValidationException(e); } } BasicUserValidator(UserStore userStore, LoggedInUsers loggedInUsers); @Override Optional<User> getUserFromAccessToken(String accessToken); @Override Optional<User> getUserFromUserId(String userId); @Override Optional<User> getUserFromPersistentId(String persistentId);  }