@Test(expected = NullPointerException.class) public void testGetUserDetailsByIdThrowsNPEIfArgsNull() throws IOException { final FilesystemUserDAO dao = new FilesystemUserDAO(tmpFile()); dao.getUserCredentialsById(null); }
@Override public Optional<UserCredentials> getUserCredentialsById(UserId id) { requireNonNull(id); try { return readUserCredentials() .filter(c -> c.getId().equals(id)) .findFirst(); } catch (IOException e) { throw new RuntimeException(e); } }
FilesystemUserDAO implements UserDAO { @Override public Optional<UserCredentials> getUserCredentialsById(UserId id) { requireNonNull(id); try { return readUserCredentials() .filter(c -> c.getId().equals(id)) .findFirst(); } catch (IOException e) { throw new RuntimeException(e); } } }
FilesystemUserDAO implements UserDAO { @Override public Optional<UserCredentials> getUserCredentialsById(UserId id) { requireNonNull(id); try { return readUserCredentials() .filter(c -> c.getId().equals(id)) .findFirst(); } catch (IOException e) { throw new RuntimeException(e); } } FilesystemUserDAO(File usersFile); }
FilesystemUserDAO implements UserDAO { @Override public Optional<UserCredentials> getUserCredentialsById(UserId id) { requireNonNull(id); try { return readUserCredentials() .filter(c -> c.getId().equals(id)) .findFirst(); } catch (IOException e) { throw new RuntimeException(e); } } FilesystemUserDAO(File usersFile); @Override Optional<UserCredentials> getUserCredentialsById(UserId id); @Override boolean addNewUser(UserId id, String authName, String authField); @Override boolean updateUserAuth(UserId id, String authName, String authField); }
FilesystemUserDAO implements UserDAO { @Override public Optional<UserCredentials> getUserCredentialsById(UserId id) { requireNonNull(id); try { return readUserCredentials() .filter(c -> c.getId().equals(id)) .findFirst(); } catch (IOException e) { throw new RuntimeException(e); } } FilesystemUserDAO(File usersFile); @Override Optional<UserCredentials> getUserCredentialsById(UserId id); @Override boolean addNewUser(UserId id, String authName, String authField); @Override boolean updateUserAuth(UserId id, String authName, String authField);  }