@Test public void testTaskExceptionCancelsInFlightTasks() throws InterruptedException {

  assumeFalse(threading == Threading.DIRECT);
  maxInFlight = 2;
  UncheckedExecutionException exception = assertThrows(
      UncheckedExecutionException.class,
      () -> parallelize(serialTasks(
          () -> translateToString(1),  // should print
          () -> blockFor(2), // Will be interrupted
          () -> fail("foobar"),  // kills the pipeline
          () -> translateToString(4))));  // should be dismissed
  assertThat(exception.getCause().getMessage()).contains("foobar");
  shutdownAndAssertInterruptedKeys().containsExactly(2);
  assertThat(translated).containsEntry(1, "1");
  assertThat(translated).doesNotContainKey(4);
}