void assertFutureTimesOut(Future<?> future,long timeoutMillis){
  long startTime=System.nanoTime();
  try {
    future.get(timeoutMillis,MILLISECONDS);
    shouldThrow();
  }
 catch (  TimeoutException success) {
  }
catch (  Exception fail) {
    threadUnexpectedException(fail);
  }
 finally {
    future.cancel(true);
  }
  assertTrue(millisElapsedSince(startTime) >= timeoutMillis);
}

void assertFutureTimesOut ( Future < ? > future , long timeoutMillis ) { long startTime = System . nanoTime ( ) ; try { future . get ( timeoutMillis , MILLISECONDS ) ; shouldThrow ( ) ; } catch ( TimeoutException success ) { } catch ( Exception fail ) { threadUnexpectedException ( fail ) ; } finally { future . cancel ( true ) ; } assertTrue ( millisElapsedSince ( startTime ) >= timeoutMillis ) ; }
checks that future . get times out , with the given millisecond timeout .
