### Question:
PhantomJsExecutor { public int execute(PhantomJsProcessBuilder runner) throws ExecutionException { try { Process process = runner.start(); inheritIO(process.getInputStream(), System.out); inheritIO(process.getErrorStream(), System.err); return process.waitFor(); } catch (InterruptedException e) { throw new ExecutionException(UNABLE_TO_EXECUTE, e); } }  int execute(PhantomJsProcessBuilder runner);  }### Answer:
@Test public void testStart() throws Exception { when(builder.start()).thenReturn(process); when(process.getInputStream()).thenReturn(inputStream); when(process.getErrorStream()).thenReturn(errorStream); executor.execute(builder); verify(process).waitFor(); }
@Test public void testCanHandleInterruption() throws Exception { when(builder.start()).thenReturn(process); when(process.getInputStream()).thenReturn(inputStream); when(process.getErrorStream()).thenReturn(errorStream); doThrow(InterruptedException.class).when(process).waitFor(); assertThatThrownBy(() -> executor.execute(builder)).isInstanceOf(ExecutionException.class); }