@Test(expected = NullPointerException.class) public void getThrowsIfHandleIsNull() { getter.get(null); }
@Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); try (ProcessToken token = tokenOpener.openToken(processHandle)) { return tokenUserFinder.findTokenUser(token).flatMap(tokenOwnerFinder::getUserName); } catch (TokenOpenException ex) { return Optional.empty(); } }
WindowsProcessOwnerGetter implements ProcessOwnerGetter { @Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); try (ProcessToken token = tokenOpener.openToken(processHandle)) { return tokenUserFinder.findTokenUser(token).flatMap(tokenOwnerFinder::getUserName); } catch (TokenOpenException ex) { return Optional.empty(); } } }
WindowsProcessOwnerGetter implements ProcessOwnerGetter { @Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); try (ProcessToken token = tokenOpener.openToken(processHandle)) { return tokenUserFinder.findTokenUser(token).flatMap(tokenOwnerFinder::getUserName); } catch (TokenOpenException ex) { return Optional.empty(); } } WindowsProcessOwnerGetter(ProcessTokenOpener tokenOpener,
                                     TokenUserFinder userFinder,
                                     TokenOwnerNameFinder nameFinder); }
WindowsProcessOwnerGetter implements ProcessOwnerGetter { @Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); try (ProcessToken token = tokenOpener.openToken(processHandle)) { return tokenUserFinder.findTokenUser(token).flatMap(tokenOwnerFinder::getUserName); } catch (TokenOpenException ex) { return Optional.empty(); } } WindowsProcessOwnerGetter(ProcessTokenOpener tokenOpener,
                                     TokenUserFinder userFinder,
                                     TokenOwnerNameFinder nameFinder); @Override Optional<String> get(ProcessHandle processHandle); }
WindowsProcessOwnerGetter implements ProcessOwnerGetter { @Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); try (ProcessToken token = tokenOpener.openToken(processHandle)) { return tokenUserFinder.findTokenUser(token).flatMap(tokenOwnerFinder::getUserName); } catch (TokenOpenException ex) { return Optional.empty(); } } WindowsProcessOwnerGetter(ProcessTokenOpener tokenOpener,
                                     TokenUserFinder userFinder,
                                     TokenOwnerNameFinder nameFinder); @Override Optional<String> get(ProcessHandle processHandle);  }