@Test public void getPidsReturnsNoPidsWhenPsapiSaysNoBytesReturned() { psapi.setEnumProcessesReturnValue(true); psapi.setEnumProcessesPids(new int[]{123, 321}); psapi.setEnumProcessesBytesReturned(0); int count = enumerator.getPids().size(); assertEquals(0, count); }
@Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); }
WindowsPidEnumerator implements PidEnumerator { @Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); } }
WindowsPidEnumerator implements PidEnumerator { @Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); } WindowsPidEnumerator(Psapi psapi); }
WindowsPidEnumerator implements PidEnumerator { @Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); } WindowsPidEnumerator(Psapi psapi); @Override List<Integer> getPids(); }
WindowsPidEnumerator implements PidEnumerator { @Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); } WindowsPidEnumerator(Psapi psapi); @Override List<Integer> getPids();  }