### Question:
MainThreadRequestListener extends RequestListenerWrapper<R> { @Override public void onSuccess(@Nonnull final R result) { mSuccessRunnable = new Runnable() { @Override public void run() { mListener.onSuccess(result); } }; mMainThread.execute(mSuccessRunnable); } MainThreadRequestListener(@Nonnull CancellableExecutor mainThread, @Nonnull RequestListener<R> listener); @Override void onSuccess(@Nonnull final R result); @Override void onError(final int response, @Nonnull final Exception e); void onCancel();  }### Answer:
@Test public void testShouldCallOnSuccess() throws Exception { final RequestListener l = mock(RequestListener.class); final MainThreadRequestListener mtl = new MainThreadRequestListener(Tests.sameThreadExecutor(), l); final Object o = new Object(); mtl.onSuccess(o); verify(l).onSuccess(eq(o)); }
@Test public void testShouldCancelSuccessRunnable() throws Exception { final RequestListener l = mock(RequestListener.class); final CancellableExecutor executor = new TestExecutor(); final MainThreadRequestListener mtl = new MainThreadRequestListener(executor, l); mtl.onSuccess(new Object()); mtl.cancel(); }