BasicFuture implements Future<T>, Cancellable { @Override public synchronized T get() throws InterruptedException, ExecutionException { while (!this.completed) { wait(); } return getResult(); } BasicFuture(final FutureCallback<T> callback); @Override boolean isCancelled(); @Override boolean isDone(); @Override synchronized T get(); @Override synchronized T get(final long timeout, final TimeUnit unit); boolean completed(final T result); boolean failed(final Exception exception); @Override boolean cancel(final boolean mayInterruptIfRunning); @Override boolean cancel();  }
@Test(expected=TimeoutValueException.class) public void testAsyncNegativeTimeout() throws Exception { final BasicFuture<Object> future = new BasicFuture<>(null); future.get(-1, TimeUnit.MILLISECONDS); }