I am writing integration tests that perform actions in the UI which start network calls using Retrofit.
I know I need to implement a
Has anyone implemented an
The most straightforward solution for this: is to basically swap out Retrofit's Thread-pool executor with an AsyncTask one (as recommended by the very helpful Nick from that linked Google group discussion). I do this like so:
new RestAdapter.Builder() .setEndpoint(LOCLSET_SERVER_URL) .setExecutors(AsyncTask.THREAD_POOL_EXECUTOR, new MainThreadExecutor()) .build();
I'm not sure if this is the most appropriate solution, but it's the quickest most sane one that I could get working. Bare in mind the caveat, that this works only for ICS+.