I am trying to create unit tests for a REST client that makes some API calls. The client works fine in a direct application, but I cannot get it to work in a test case.
Obviously, LoaderTestCase.getLoaderResultSynchronously () can be used here (at least according to the Android link, but it does not accept my bootloader. Code:
public void testGetEventInfo() {
...
RESTLoader loader = new RESTLoader(getContext(),
RESTLoader.HTTPVerb.GET, action, params, LOADER_GET_NEWS);
getLoaderResultSynchronously(loader);
}
This leads to an error getLoaderResultSynchronously (Loader) in type LoaderTestCase is not applicable for arguments (RESTLoader).
RESTLoader extends AsyncLoader. Please note that I use the support library, maybe the bootloader is not compatible there? The documentation does not provide information about this.
I tried to solve this in several ways, although none of them work:
- .
- CountdownLatch ( ). , - / .
- () .
- SO, .
- , getLoaderResultSynchronously ? , ? , .
,