@Test
public void testFailedFuture() throws Exception {

  CompletableFuture<Object> asyncFuture =
      FutureUtils.failedFuture(new IllegalStateException("Test failed feature"));
  assertTrue("future should be complete", asyncFuture.isDone());
  assertTrue("Should complete with exception", asyncFuture.isCompletedExceptionally());
  thrown.expect(ExecutionException.class);
  thrown.expectCause(IsInstanceOf.<Throwable>instanceOf(IllegalStateException.class));
  thrown.expectMessage(containsString("Test failed feature"));
  asyncFuture.get();
}