@Test public void getsCorrectProcessDescriptions() { Map<Integer, String> pidDescriptions = new HashMap<>(); pidDescriptions.put(123, "toaster"); pidDescriptions.put(1, null); pidDescriptions.put(3848, "ayy"); List<Integer> expectedPids = new ArrayList<>(pidDescriptions.keySet()); pidEnumerator = () -> new ArrayList<>(expectedPids); collector = pid -> new NativeProcessImpl(pid, pidDescriptions.get(pid), null); List<NativeProcess> processes = enumerator.getProcesses(); for (NativeProcess process : processes) { int pid = process.getPid(); String description = process.getDescription(); assertEquals(pidDescriptions.get(pid), description); } }
@Override public List<NativeProcess> getProcesses() { return pidEnumerator .getPids() .stream() .map(processCollector::collect) .collect(Collectors.toList()); }
NativeProcessEnumeratorImpl implements NativeProcessEnumerator { @Override public List<NativeProcess> getProcesses() { return pidEnumerator .getPids() .stream() .map(processCollector::collect) .collect(Collectors.toList()); } }
NativeProcessEnumeratorImpl implements NativeProcessEnumerator { @Override public List<NativeProcess> getProcesses() { return pidEnumerator .getPids() .stream() .map(processCollector::collect) .collect(Collectors.toList()); } NativeProcessEnumeratorImpl(PidEnumerator pidEnumerator,
                                       NativeProcessCollector processCollector); }
NativeProcessEnumeratorImpl implements NativeProcessEnumerator { @Override public List<NativeProcess> getProcesses() { return pidEnumerator .getPids() .stream() .map(processCollector::collect) .collect(Collectors.toList()); } NativeProcessEnumeratorImpl(PidEnumerator pidEnumerator,
                                       NativeProcessCollector processCollector); @Override List<NativeProcess> getProcesses(); }
NativeProcessEnumeratorImpl implements NativeProcessEnumerator { @Override public List<NativeProcess> getProcesses() { return pidEnumerator .getPids() .stream() .map(processCollector::collect) .collect(Collectors.toList()); } NativeProcessEnumeratorImpl(PidEnumerator pidEnumerator,
                                       NativeProcessCollector processCollector); @Override List<NativeProcess> getProcesses();  }