I am new to Loaders and am trying to test the most basic AsyncTaskLoader
in a LoaderTestCase
. However getLoaderResultSynchronously
never finishes. This ist the whole class:
public class LoaderTest extends LoaderTestCase{
public void testLoader() {
String result = getLoaderResultSynchronously(new AsyncTaskLoader<String>(getContext()){
@Override
public String loadInBackground() {
return "hello";
}
});
assertEquals(result, "hello");
}
}
What am I missing?
The getLoaderResultSynchronously() call startLoading() and stopLoading() methods of the Loader passed by parameter. You must implement it.