Android.Test.Mock Namespace

Utility classes providing stubs or mocks of various Android framework building blocks.

Classes

Name Description
MockApplication

A mock android.app.Application class.

MockContentProvider

Mock implementation of ContentProvider.

MockContentResolver

An extension of android.content.ContentResolver that is designed for testing.

MockContext

A mock android.content.Context class.

MockCursor

A mock android.database.Cursor class that isolates the test code from real Cursor implementation.

MockDialogInterface

A mock android.content.DialogInterface class.

MockDialogInterface.InterfaceConsts

Exposes the dialog button constants from IDialogInterface.

MockPackageManager

A mock android.content.pm.PackageManager class.

MockResources

A mock android.content.res.Resources class.

Remarks

This namespace supplies mock implementations of Android framework classes. Subclasses can override the operations needed by a test. Most mock operations throw UnsupportedOperationException until overridden. MockContentResolver instead resolves providers from its local map and ignores change notifications. MockResources.UpdateConfiguration does nothing.

Implementation source: Android framework mock classes.