Skip to content Skip to sidebar Skip to footer

Android Unit Testing With Contentproviders

I have been struggling with a unit testing problem on Android for a while now. My app uses a Sqlite DB to store details on vehicles. I have recently added the ContentProvider patte

Solution 1:

I think you should call setContext() in your setUp():

// warning: untested codeprotectedvoidsetUp()throws Exception
{
    super.setUp();
    setContext(newRenamingDelegatingContext(getTargetContext(), "test.");

    ...
}

In that case you may need to change your base class to ProviderTestCase2 probably.

Post a Comment for "Android Unit Testing With Contentproviders"