@SuppressWarnings("ThrowableNotThrown")
@Test
public void onResult_setExceptionTemplate_withTemplateProvider() throws Exception {

    ResultListenerProxy proxy = new ResultListenerProxy(mSender);
    proxy.onResult(mResult);
    Mockito.verify(mSender).deliver(mMessageCaptor.capture());
    Message<ResultListener<Object>, Void> message = mMessageCaptor.getValue();
    Assert.assertNotNull(message);
    Mockito.doReturn(mException).when(mListenerWithExceptionTemplate).exception();
    message.invoke(mListenerWithExceptionTemplate);
    Mockito.verify(mListenerWithExceptionTemplate).onResult(mResult);
    Assert.assertSame(mException, message.exception());
}