### Question:
Deferred implements Promise<T>, Completable<T> { @Override public void setFailure(final Throwable cause) { if (!tryFailure(cause)) { throw new IllegalStateException("Deferred is already complete"); } } Deferred();  Deferred(final T value);  Deferred(final Throwable cause); final boolean trySuccess(final T value); final boolean tryFailure(final Throwable cause); @Override void setSuccess(final T value); @Override void setFailure(final Throwable cause); @Override final boolean isComplete(); @Override void then(final Completable<? super T> completable); @Override final Promise<R> then(final Continuation<? super T, ? extends R> continuation);  }### Answer:
@Test public void setFailureTest() { final Deferred<Integer> deferred = new Deferred<>(); final boolean failure = deferred.tryFailure(new Throwable()); assertTrue(failure); assertTrue(deferred.isComplete()); }