@Test public void retrieveUser_retrievesUser_withException_notifiesCallback() throws IOException { IOException e = new IOException(); WebService webService = mock(WebService.class); when(webService.retrieveUser()).thenThrow(e); UserRetriever.UserCallback callback = mock(UserRetriever.UserCallback.class); UserRetriever userRetriever = new UserRetriever(webService, TestAsyncTaskExecutor.instance()); userRetriever.retrieveUser(callback); verify(callback).onException(e); }
public void retrieveUser(final UserCallback callback) { mExecutor.execute(new RetrieveUserTask(callback)); }
UserRetriever { public void retrieveUser(final UserCallback callback) { mExecutor.execute(new RetrieveUserTask(callback)); } }
UserRetriever { public void retrieveUser(final UserCallback callback) { mExecutor.execute(new RetrieveUserTask(callback)); } UserRetriever(final WebService webService, final AsyncTaskExecutor executor); }
UserRetriever { public void retrieveUser(final UserCallback callback) { mExecutor.execute(new RetrieveUserTask(callback)); } UserRetriever(final WebService webService, final AsyncTaskExecutor executor); void retrieveUser(final UserCallback callback); }
UserRetriever { public void retrieveUser(final UserCallback callback) { mExecutor.execute(new RetrieveUserTask(callback)); } UserRetriever(final WebService webService, final AsyncTaskExecutor executor); void retrieveUser(final UserCallback callback);  }