### Question:
MonitorUtils { public static boolean isPidRunning(int pid) { return isPidRunning(pid, null); }  static boolean isUrlUp(URL url); static boolean isPidRunning(int pid); static boolean isPidRunning(int pid, String regex); static List<Integer> getRunningPids(String regex); static List<Integer> getRunningPids(String regex, String excludingRegex); static MemoryUsage getMemoryUsage(int pid); static MemoryUsage getMemoryUsage(int pid, String clazzRegexOfInterest, int minInstancesOfInterest); static List<String> searchLog(File file, String grepOfInterest); static List<String> searchLog(File file, String grepOfInterest, Set<String> grepExclusions); static Process exec(String cmd); static String waitFor(Process process); static int findOwnPid();  }### Answer:
@Test(groups="UNIX") public void testIsPidRunning() throws Exception { int usedPid = MonitorUtils.findOwnPid(); String[] cmd = new String[]{"bash", "-c", "echo $$"}; Process process = Runtime.getRuntime().exec(cmd); String out = MonitorUtils.waitFor(process); int unusedPid = Integer.parseInt(out.trim()); assertTrue(MonitorUtils.isPidRunning(usedPid)); assertFalse(MonitorUtils.isPidRunning(unusedPid)); try { assertFalse(MonitorUtils.isPidRunning(1234567)); } catch (ProcessHasStderr e) { } }