### Question:
DefaultPromiseAdapter implements PromiseAdapter { @Override public <T> Promise<T> toPromise(Consumer<Handler<AsyncResult<T>>> consumer) { Deferred<T> d = when.defer(); consumer.accept(toHandler(d)); return d.getPromise(); } @Inject  DefaultPromiseAdapter(When when); @Override Promise<T> toPromise(Consumer<Handler<AsyncResult<T>>> consumer); @Override Handler<AsyncResult<T>> toHandler(Resolver<T> resolver);  }### Answer:
@Test public void testToPromise() throws Exception { adapter.toPromise(consumer); verify(when).defer(); verify(consumer).accept(any()); }
@Test public void testToPromise1() throws Exception { adapter.toPromise(future); future.complete(); verify(when).defer(); verify(future).setHandler(any()); }