UiThreadPoster { public void post(Runnable runnable) { mUiHandler.post(runnable); } UiThreadPoster(); void post(Runnable runnable);  }
@Test public void execute_delegatesToUiHandler() throws Exception { Runnable runnable = new Runnable() { @Override public void run() { } }; ArgumentCaptor<Runnable> ac = ArgumentCaptor.forClass(Runnable.class); SUT.post(runnable); verify(mUiHandlerMock, times(1)).post(ac.capture()); assertThat(ac.getValue(), is(runnable)); }