@Test
public void testBothFutureFailure() {

  Future<Integer> originalFuture = getFuture(200, 1, false);
  Function0<Future<Integer>> backupFunctionFuture = getBackupFutureFunctionWithFailure(200, 2);
  Future<Integer> speculativeFuture = FutureUtil.getSpeculativeFuture(
      originalFuture, backupFunctionFuture, 100, STATS_PREFIX);
  Exception e = null;
  try {
    speculativeFuture.get();
  } catch (RuntimeException re) {
    e = re;
  }
  assertNotNull(e);
  assertEquals(EXCEPTION_MSG, e.getMessage());
  assertTrue(isBackupFutureInvoked);
  checkStats(1, 0, 0);
}