PromiseProxy extends Promise<R> implements Message<T, R>, ActionHandle, ResultListener<R> { @NonNull @Override public ActionHandle then(@NonNull ResultListener<R> listener) { mListener = listener; mSender.deliver(this); return this; } PromiseProxy(@NonNull MessageSender sender, @NonNull Message<T, R> message); @Override void thenNothing(); @NonNull @Override ActionHandle then(@NonNull ResultListener<R> listener); @NonNull @Override ActionHandle then(@NonNull ActorThread thread, @NonNull ResultListener<R> listener); @Nullable @Override R get(); @Override void onResult(@Nullable R result); @Override void forget(); @Override Promise<R> invoke(@NonNull T impl); @NonNull @Override ActorInvokeException exception(); @Override String toString();  }
@Test public void then_deliverSelf_withListener() throws Exception { PromiseProxy promise = new PromiseProxy(mSender, mMessage); promise.then(mListener); Mockito.verify(mSender).deliver(promise); }
@Test public void then_deliverSelf_withListenerAndThread() throws Exception { PromiseProxy promise = new PromiseProxy(mSender, mMessage); promise.then(mThread, mListener); Mockito.verify(mSender).deliver(promise); }