Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public abstract class

ProviderTestCase

extends InstrumentationTestCase
java.lang.Object
   ↳ junit.framework.Assert
     ↳ junit.framework.TestCase
       ↳ android.test.InstrumentationTestCase
         ↳ android.test.ProviderTestCase<T extends  android.content.ContentProvider >

This class was deprecated in API level 3.
this class extends InstrumentationTestCase but should extend AndroidTestCase. Use ProviderTestCase2, which corrects this problem, instead.

Class Overview

If you would like to test a single content provider with an InstrumentationTestCase , this provides some of the boiler plate in setUp() and tearDown() .

Summary

Public Constructors
, java.lang.String)">ProviderTestCase ( Class <T> providerClass, String providerAuthority)
Public Methods
MockContentResolver getMockContentResolver ()
IsolatedContext getMockContext ()
T getProvider ()
static <T extends  ContentProvider > ContentResolver , java.lang.String, java.lang.String, int, java.lang.String)">newResolverWithContentProviderFromSql ( Context targetContext, Class <T> providerClass, String authority, String databaseName, int databaseVersion, String sql)
Protected Methods
void setUp ()
Sets up the fixture, for example, open a network connection.
void tearDown ()
Tears down the environment for the test fixture.
[Expand]
Inherited Methods
From class android.test.InstrumentationTestCase
From class junit.framework.TestCase
From class junit.framework.Assert
From class java.lang.Object
From interface junit.framework.Test

Public Constructors

, java.lang.String)">

public ProviderTestCase ( Class <T> providerClass, String providerAuthority)

Added in API level 1

Public Methods

public MockContentResolver getMockContentResolver ()

Added in API level 1

public IsolatedContext getMockContext ()

Added in API level 1

public T getProvider ()

Added in API level 1

, java.lang.String, java.lang.String, int, java.lang.String)">

public static ContentResolver newResolverWithContentProviderFromSql ( Context targetContext, Class <T> providerClass, String authority, String databaseName, int databaseVersion, String sql)

Added in API level 1

Protected Methods

protected void setUp ()

Added in API level 1

Sets up the fixture, for example, open a network connection. This method is called before a test is executed.

protected void tearDown ()

Added in API level 1

Tears down the environment for the test fixture.

Calls shutdown() on the ContentProvider represented by mProvider.