### Question:
PromiseImpl implements SealedPromise<T> { @Override public Try<T> get() { if (isEmpty()) { synchronized (state) { if (isEmpty()) { try { state.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return Try.failure(e); } } } } return TryOf.narrowK(checkNonNull(reference.get())); } PromiseImpl(Executor executor); @Override boolean tryComplete(Try<? extends T> value); @Override Try<T> get(); @Override Try<T> get(Duration timeout); @Override boolean isCompleted(); @Override Promise<T> onComplete(Consumer1<? super Try<? extends T>> consumer); @Override Promise<R> map(Function1<? super T, ? extends R> mapper);  }### Answer:
@Test public void getTimeout() { Promise<String> promise = Promise.make(); Try<String> result = promise.get(Duration.ofMillis(500)); assertTrue(result.isFailure()); assertTrue(result.getCause() instanceof TimeoutException); }
@Test public void get() { Promise<String> promise = Promise.make(); Try<String> value = Try.success("hello world!"); executor.schedule(() -> promise.tryComplete(value), 500, TimeUnit.MILLISECONDS); assertEquals(value, promise.get()); }
@Test public void toFuture() { Promise<String> promise = Promise.<String>make().succeeded("hola mundo!"); Try<String> result = promise.get(); assertEquals(Try.success("hola mundo!"), result); }