MessageBase implements Message<T, R> { protected Promise<R> verifyResult(Promise<R> result) { if (result == null) { AssertionError exception = new AssertionError("Actor methods are not allowed to return null"); exception.initCause(mExceptionTemplate); throw exception; } return result; } protected  MessageBase(@NonNull ActorInvokeException exception); @NonNull @Override ActorInvokeException exception();  }
@Test(expected = AssertionError.class) public void verifyResult_throw_nullResult() { MessageBase<Object, Object> message = new MockMessageBase<>(mException); message.verifyResult(null); }
@Test public void verifyResult_returnSame_nonNullResult() { MessageBase<Object, Object> message = new MockMessageBase<>(mException); Assert.assertSame(mPromise, message.verifyResult(mPromise)); }