Utils { public static ArrayList<String> runProcess(String... commands) throws InterruptedException, IOException { final java.lang.ProcessBuilder processBuilder = new java.lang.ProcessBuilder(commands); final ArrayList<String> output = new ArrayList<>(); final Process process = processBuilder.start(); process.waitFor(); final InputStream inputStream = process.getInputStream(); try { final java.io.BufferedReader reader = new java.io.BufferedReader( new InputStreamReader(inputStream, StandardCharsets.UTF_8)); String line; while ((line = reader.readLine()) != null) { output.add(line); } } finally { inputStream.close(); } return output; } private  Utils(); static boolean equals(final Object a, final Object b); static T nonNull(final T t); static File findFilefromDir(final File dir, final String fn); static T ifNull(final T value, final T defaultValue); static void croak(final String message, final int exitCode); static boolean isValidPort(final int port); static File createTempDir(); static File createTempDir(final File parent); static void zip(final File input, final File output); static void zipFolderContent(final File folder, final File output); static void unzip(final ZipFile source, final File dest); static String flattenToString(final Collection<?> collection,
      final String delimiter); static Double convertToDouble(final Object obj); static Object callConstructor(final Class<?> cls, final Object... args); static Object invokeStaticMethod(final ClassLoader loader, final String className,
      final String methodName, final Object... args); static void copyStream(final InputStream input, final OutputStream output); static long parseMemString(final String strMemSize); static CronExpression parseCronExpression(final String cronExpression,
      final DateTimeZone timezone); static boolean isCronExpressionValid(final String cronExpression,
      final DateTimeZone timezone); static ArrayList<String> runProcess(String... commands); static void mergeTypeClassPaths(
      List<String> destinationPaths, final List<String> sourcePaths, final String rootPath); static void mergeStringList(
      final List<String> destinationList, final List<String> sourceList);  }
@Test public void testRunProcess() throws IOException, InterruptedException { ArrayList<String> result = Utils.runProcess("/bin/bash", "-c", "ls"); Assert.assertNotEquals(result.size(), 0); }