@Test(timeout = 5000, expected = IOException.class)
public void testErrorWhenFuture() throws Exception {

  // Failing future
  final CompletableFuture failingFuture = generateFailingFuture();
  final InputReader inputReader = generateInputReader(failingFuture);
  // Fetcher
  final ParentTaskDataFetcher fetcher = createFetcher(inputReader);
  // Should throw an IOException
  fetcher.fetchDataElement(); // checked by 'expected = IOException.class'
  assertTrue(failingFuture.isCompletedExceptionally());
}