public static <T> Promise<T> error(final Throwable error) {
    return new ResolvedError<T>(error);
  }
@Test
  public void testError() {
    final Exception error = new Exception();
    final Promise<?> promise = Promises.error(error);

    assertTrue(promise.isDone());
    assertTrue(promise.isFailed());
    assertEquals(error, promise.getError());
  }