@Test public void testTaskExceptionDismissesPendingTasks() {

  maxInFlight = 2;
  UncheckedExecutionException exception = assertThrows(
      UncheckedExecutionException.class,
      () -> parallelize(Stream.of(
          // With maxInflight=2, at least one will print, even if a fail() task races it.
          () -> translateToString(1), () -> translateToString(1),
          () -> fail("foobar"), () -> fail("foobar"),  // both should fail
          () -> translateToString(5))));  // should be dismissed
  assertThat(exception.getCause().getMessage()).contains("foobar");
  assertThat(translated).containsEntry(1, "1");
  assertThat(translated).doesNotContainKey(5);
}