### Question:
MonitorUtils { public static List<String> searchLog(File file, String grepOfInterest) { return searchLog(file, grepOfInterest, new LinkedHashSet<String>()); }  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 testSearchLog() throws Exception { String fileContents = "line1\nline2\nline3\n"; File file = File.createTempFile("monitorUtilsTest.testSearchLog", ".txt"); Files.write(fileContents, file, Charsets.UTF_8); try { assertEquals(MonitorUtils.searchLog(file, "line1"), Arrays.asList("line1")); assertEquals(MonitorUtils.searchLog(file, "line1|line2"), Arrays.asList("line1", "line2")); assertEquals(MonitorUtils.searchLog(file, "textnotthere"), Collections.emptyList()); assertEquals(MonitorUtils.searchLog(file, "line"), Arrays.asList("line1", "line2", "line3")); } finally { file.delete(); } }