@Test
public void testNoBackupFutureExecutedEarlyFailureForTimeBasedPolicy() {

  // First future fails soon enough.
  Future<Integer> originalFuture = getFuture(50, 1, false);
  Function0<Future<Integer>> backupFunctionFuture = getBackupFutureFunctionWithSuccess(500, 2);
  Future<Integer> speculativeFuture = FutureUtil.getSpeculativeFuture(
      originalFuture,
      backupFunctionFuture,
      100,
      STATS_PREFIX,
      BackupFutureRetryPolicy.TIMEOUT_RETRY_POLICY);
  Exception e = null;
  try {
    speculativeFuture.get();
  } catch (RuntimeException re) {
    e = re;
  }
  assertNotNull(e);
  assertEquals(EXCEPTION_MSG, e.getMessage());
  assertFalse(isBackupFutureInvoked);
  checkStats(0, 0, 0);
}