The ProviderTestCase2<T> class

This is a test case designed to test the ContentProvider classes.

The ProviderTestCase2 class also extends AndroidTestCase. The class template parameter T represents ContentProvider under test. Implementation of this test uses IsolatedContext and MockContentResolver, which are mock objects that we described before in this chapter.

The constructor

There is only one public non-deprecated constructor for this class. This is as follows:

ProviderTestCase2(Class<T> providerClass, String providerAuthority)

This should be invoked with an instance of the ContentProvider class for the same ContentProvider class used as a class template parameter.

The second parameter is the authority for the provider, which is usually defined as ...

Get Learning Android Application Testing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.