public abstract class

ProviderTestCase2

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

Class Overview

This TestCase class provides a framework for isolated testing of a single ContentProvider. It uses a MockContentResolver to access the provider, restricts the provider to an isolated area of the filesystem (for safely creating & modifying databases & files), and injects IsolatedContext to isolate the ContentProvider from the rest of the running system.

This environment is created automatically by setUp() and tearDown().

Summary

[Expand]
Inherited Fields
From class android.test.AndroidTestCase
Public Constructors
ProviderTestCase2(Class<T> providerClass, String providerAuthority)
Public Methods
MockContentResolver getMockContentResolver()
IsolatedContext getMockContext()
T getProvider()
static <T extends ContentProvider> ContentResolver newResolverWithContentProviderFromSql(Context targetContext, String filenamePrefix, 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.
[Expand]
Inherited Methods
From class android.test.AndroidTestCase
From class junit.framework.TestCase
From class junit.framework.Assert
From class java.lang.Object
From interface junit.framework.Test

Public Constructors

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

Public Methods

public MockContentResolver getMockContentResolver ()

public IsolatedContext getMockContext ()

public T getProvider ()

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

Protected Methods

protected void setUp ()

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

Throws
Exception