@Test public void declinesNonDirectoryFiles() { String procName = generateRandomValidProcName(); boolean result = procPathFilter.accept(false, procName); assertFalse("Expected filter to decline non-directory named " + procName, result); }
boolean accept(boolean isDirectory, String fileName) { if (!isDirectory) { return false; } Integer numericalPid = tryParseInt(fileName); return numericalPid != null && numericalPid >= LinuxConstants.LOWEST_LEGAL_PID && numericalPid < pidMax; }
ProcPathFilter implements BiPredicate<Path, BasicFileAttributes> { boolean accept(boolean isDirectory, String fileName) { if (!isDirectory) { return false; } Integer numericalPid = tryParseInt(fileName); return numericalPid != null && numericalPid >= LinuxConstants.LOWEST_LEGAL_PID && numericalPid < pidMax; } }
ProcPathFilter implements BiPredicate<Path, BasicFileAttributes> { boolean accept(boolean isDirectory, String fileName) { if (!isDirectory) { return false; } Integer numericalPid = tryParseInt(fileName); return numericalPid != null && numericalPid >= LinuxConstants.LOWEST_LEGAL_PID && numericalPid < pidMax; } ProcPathFilter(int pidMax); }
ProcPathFilter implements BiPredicate<Path, BasicFileAttributes> { boolean accept(boolean isDirectory, String fileName) { if (!isDirectory) { return false; } Integer numericalPid = tryParseInt(fileName); return numericalPid != null && numericalPid >= LinuxConstants.LOWEST_LEGAL_PID && numericalPid < pidMax; } ProcPathFilter(int pidMax); @Override boolean test(Path path, BasicFileAttributes basicFileAttributes); }
ProcPathFilter implements BiPredicate<Path, BasicFileAttributes> { boolean accept(boolean isDirectory, String fileName) { if (!isDirectory) { return false; } Integer numericalPid = tryParseInt(fileName); return numericalPid != null && numericalPid >= LinuxConstants.LOWEST_LEGAL_PID && numericalPid < pidMax; } ProcPathFilter(int pidMax); @Override boolean test(Path path, BasicFileAttributes basicFileAttributes);  }