PromiseProxy extends Promise<R> implements Message<T, R>, ActionHandle, ResultListener<R> { @NonNull @Override public ActorInvokeException exception() { return mMessage.exception(); } 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();  }
@SuppressWarnings("ThrowableNotThrown") @Test public void exception_returnFromMessage_always() { final ActorInvokeException exception = Mockito.mock(ActorInvokeException.class); Mockito.doReturn(exception).when(mMessage).exception(); PromiseProxy promise = new PromiseProxy(mSender, mMessage); Assert.assertSame(exception, promise.exception()); }