@Test public void throwsWhenProcessFails() { RuntimeException e = Assertions.assertThrows(RuntimeException.class, () -> { IoUtils.runCommand("thisCommandDoesNotExist" + new Random().nextInt(1000)); }); assertThat(e.getMessage(), containsString("failed with exit code")); }
public static String runCommand(String command) { return runCommand(command, Paths.get(System.getProperty("user.dir"))); }
IoUtils { public static String runCommand(String command) { return runCommand(command, Paths.get(System.getProperty("user.dir"))); } }
IoUtils { public static String runCommand(String command) { return runCommand(command, Paths.get(System.getProperty("user.dir"))); } private  IoUtils(); }
IoUtils { public static String runCommand(String command) { return runCommand(command, Paths.get(System.getProperty("user.dir"))); } private  IoUtils(); static byte[] toByteArray(InputStream is); static String toUtf8String(InputStream is); static String readUtf8File(String path); static String readUtf8File(Path path); static String readUtf8Resource(ClassLoader classLoader, String resourcePath); static String readUtf8Resource(Class<?> clazz, String resourcePath); static String readUtf8Url(URL url); static String runCommand(String command); static String runCommand(String command, Path directory); static int runCommand(String command, Path directory, Appendable output); }
IoUtils { public static String runCommand(String command) { return runCommand(command, Paths.get(System.getProperty("user.dir"))); } private  IoUtils(); static byte[] toByteArray(InputStream is); static String toUtf8String(InputStream is); static String readUtf8File(String path); static String readUtf8File(Path path); static String readUtf8Resource(ClassLoader classLoader, String resourcePath); static String readUtf8Resource(Class<?> clazz, String resourcePath); static String readUtf8Url(URL url); static String runCommand(String command); static String runCommand(String command, Path directory); static int runCommand(String command, Path directory, Appendable output);  }