PromiseProxy extends Promise<R> implements Message<T, R>, ActionHandle, ResultListener<R> { @Override public Promise<R> invoke(@NonNull T impl) { Promise<R> result = mMessage.invoke(impl); if (result != null) { ResultListener<R> listener = mListener; if (listener != null && mActorThread != null) { result.then(mActorThread, this); } else { mListener = null; result.then(listener); } } mActorThread = null; return null; } 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 invoke_invokeMessage_withoutResult() { PromiseProxy promise = new PromiseProxy(mSender, mMessage); promise.invoke(mImpl); Mockito.verify(mMessage).invoke(mImpl); }