StormCLIWrapper { protected int runCommand(String[] command) throws RestException { ProcessBuilder pb = getProcessBuilder(command); pb.inheritIO(); LOG.debug("Running command: cmd={}", String.join(" ", command)); Process process; try { process = pb.start(); process.waitFor(); } catch (Exception e) { throw new RestException(e); } int exitValue = process.exitValue(); LOG.debug("Command completed: cmd={}, exit={}", String.join(" ", command), exitValue); return exitValue; }  @Autowired void setEnvironment(final Environment environment); int startParserTopology(String name); int stopParserTopology(String name, boolean stopNow); int startEnrichmentTopology(); int stopEnrichmentTopology(boolean stopNow); int startIndexingTopology(String scriptPath); int stopIndexingTopology(String name, boolean stopNow); Map<String, String> getStormClientStatus();  }
@Test public void runCommandShouldReturnRestExceptionOnError() throws Exception { when(processBuilder.start()).thenThrow(new IOException()); assertThrows(RestException.class, () -> stormCLIWrapper.runCommand(new String[]{"storm", "kill"})); }