@Test public void getReturnsEmptyStringIfKernelSaysItWroteZeroBytes() { nameQuerier = (procHandle, flags, exeName, bufSize) -> { char[] name = "Image name that isn not empty.exe".toCharArray(); System.arraycopy(name, 0, exeName, 0, name.length); bufSize.setValue(0); return true; }; Optional<String> result = getter.get(handle); assertEquals(0, result.get().length()); }
@Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); return getProcessImageName(processHandle.getNativeHandle()); }
WindowsProcessDescriptionGetter implements ProcessDescriptionGetter { @Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); return getProcessImageName(processHandle.getNativeHandle()); } }
WindowsProcessDescriptionGetter implements ProcessDescriptionGetter { @Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); return getProcessImageName(processHandle.getNativeHandle()); } WindowsProcessDescriptionGetter(QueryFullProcessImageName winapi); }
WindowsProcessDescriptionGetter implements ProcessDescriptionGetter { @Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); return getProcessImageName(processHandle.getNativeHandle()); } WindowsProcessDescriptionGetter(QueryFullProcessImageName winapi); @Override Optional<String> get(ProcessHandle processHandle); }
WindowsProcessDescriptionGetter implements ProcessDescriptionGetter { @Override public Optional<String> get(ProcessHandle processHandle) { Objects.requireNonNull(processHandle, "processHandle cannot be null!"); return getProcessImageName(processHandle.getNativeHandle()); } WindowsProcessDescriptionGetter(QueryFullProcessImageName winapi); @Override Optional<String> get(ProcessHandle processHandle);  }