@Test(timeout = 5000)
public void testErrorWhenFutureWithRetry() throws Exception {

  // Failing future
  final CompletableFuture failingFuture = generateFailingFuture();
  final InputReader inputReader = generateInputReader(
    failingFuture,
    BlockFetchFailureProperty.of(BlockFetchFailureProperty.Value.RETRY_AFTER_TWO_SECONDS_FOREVER)); // retry
  final List<String> empty = new ArrayList<>(0); // empty data
  when(inputReader.retry(anyInt()))
    .thenReturn(generateCompletableFuture(
      empty.iterator())); // success upon retry
  // Fetcher should work on retry
  final ParentTaskDataFetcher fetcher = createFetcher(inputReader);
  assertEquals(Finishmark.getInstance(), fetcher.fetchDataElement());
}