### Question:
ExecuteProcessUtils { public static boolean executeCommand(ProcessBuilder builder, StringBuilder output) { boolean success = false; try { Process p = builder.start(); if (output != null) { readOutput(p, output); logger.debug(output.toString()); } success = p.waitFor(5, TimeUnit.SECONDS) && p.exitValue() == 0; if (p.isAlive()) { p.destroyForcibly(); } } catch (InterruptedException | IOException e) { logger.info("Exception during command execution", e); return false; } return success; } private  ExecuteProcessUtils(); static boolean executeCommand(ProcessBuilder builder, StringBuilder output);  }### Answer:
@Test public void testExecuteCommand() throws IOException { final String folderName = RandomStringUtils.randomAlphanumeric(16); Path tempFolder = Paths.get(FileUtils.getTempDirectoryPath(), folderName); if (!Files.exists(tempFolder)) { Files.createDirectory(tempFolder); } final String fileName = RandomStringUtils.randomAlphanumeric(16); Path tempFile = tempFolder.resolve(fileName); Files.createFile(tempFile); ProcessBuilder builder = new ProcessBuilder(); if (OsUtils.isWindows()) { builder.command("cmd", "/c", "dir", tempFolder.toString()); } else { builder.command("dir", tempFolder.toString()); } StringBuilder output = new StringBuilder(); ExecuteProcessUtils.executeCommand(builder, output); assertTrue(output.toString().contains(fileName)); FileUtils.deleteDirectory(tempFolder.toFile()); }