@Test
public void testFailed() throws Exception {

    final BasicFutureCallback<Object> callback = new BasicFutureCallback<>();
    final BasicFuture<Object> future = new BasicFuture<>(callback);
    final Object result = new Object();
    final Exception boom = new Exception();
    future.failed(boom);
    future.completed(result);
    Assert.assertFalse(callback.isCompleted());
    Assert.assertNull(callback.getResult());
    Assert.assertTrue(callback.isFailed());
    Assert.assertSame(boom, callback.getException());
    Assert.assertFalse(callback.isCancelled());
    try {
        future.get();
    } catch (final ExecutionException ex) {
        Assert.assertSame(boom, ex.getCause());
    }
    Assert.assertTrue(future.isDone());
    Assert.assertFalse(future.isCancelled());
}