@Test public void testErrorSubmitRunnerAndWait() throws Exception { int expectedExitCode = 1; MultiLangDaemon.MultiLangRunner runner = new MultiLangDaemon.MultiLangRunner(scheduler); when(config.getExecutorService()).thenReturn(executorService); when(executorService.submit(eq(runner))).thenReturn(futureInteger); when(futureInteger.get()).thenThrow(ExecutionException.class); int exitCode = daemon.submitRunnerAndWait(config, runner); assertThat(exitCode, equalTo(expectedExitCode)); }
int submitRunnerAndWait(final MultiLangDaemonConfig config, final MultiLangRunner runner) { ExecutorService executorService = config.getExecutorService(); Future<Integer> future = executorService.submit(runner); try { return future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Encountered an error while running daemon", e); } return 1; }
MultiLangDaemon { int submitRunnerAndWait(final MultiLangDaemonConfig config, final MultiLangRunner runner) { ExecutorService executorService = config.getExecutorService(); Future<Integer> future = executorService.submit(runner); try { return future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Encountered an error while running daemon", e); } return 1; } }
MultiLangDaemon { int submitRunnerAndWait(final MultiLangDaemonConfig config, final MultiLangRunner runner) { ExecutorService executorService = config.getExecutorService(); Future<Integer> future = executorService.submit(runner); try { return future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Encountered an error while running daemon", e); } return 1; }  }
MultiLangDaemon { int submitRunnerAndWait(final MultiLangDaemonConfig config, final MultiLangRunner runner) { ExecutorService executorService = config.getExecutorService(); Future<Integer> future = executorService.submit(runner); try { return future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Encountered an error while running daemon", e); } return 1; }  static void main(final String[] args); }
MultiLangDaemon { int submitRunnerAndWait(final MultiLangDaemonConfig config, final MultiLangRunner runner) { ExecutorService executorService = config.getExecutorService(); Future<Integer> future = executorService.submit(runner); try { return future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Encountered an error while running daemon", e); } return 1; }  static void main(final String[] args);  }