Stay organized with collections
Save and categorize content based on your preferences.
android.test.mock
Utility classes providing stubs or mocks of various Android framework building blocks.
For more information, see the
Testing guide.
Classes
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# android.test.mock\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nandroid.test.mock\n=================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/test/mock/package-summary \"View this page in Kotlin\") \\|Java\n\nUtility classes providing stubs or mocks of various Android framework building blocks.\n\nFor more information, see the\n[Testing](/tools/testing) guide.\n\n\nClasses\n-------\n\n|-------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [MockAccountManager](/reference/android/test/mock/MockAccountManager) | *This class was deprecated in API level 28. Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](/ tools/testing-support-library).* |\n| [MockApplication](/reference/android/test/mock/MockApplication) | *This class was deprecated in API level 24. Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](/tools/testing-support-library).* |\n| [MockContentProvider](/reference/android/test/mock/MockContentProvider) | Mock implementation of ContentProvider. |\n| [MockContentResolver](/reference/android/test/mock/MockContentResolver) | An extension of [ContentResolver](/reference/android/content/ContentResolver) that is designed for testing. |\n| [MockContext](/reference/android/test/mock/MockContext) | A mock [Context](/reference/android/content/Context) class. |\n| [MockCursor](/reference/android/test/mock/MockCursor) | *This class was deprecated in API level 24. Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](/tools/testing-support-library).* |\n| [MockDialogInterface](/reference/android/test/mock/MockDialogInterface) | *This class was deprecated in API level 24. Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](/tools/testing-support-library).* |\n| [MockPackageManager](/reference/android/test/mock/MockPackageManager) | *This class was deprecated in API level 24. Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](/tools/testing-support-library).* |\n| [MockResources](/reference/android/test/mock/MockResources) | *This class was deprecated in API level 24. Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](/tools/testing-support-library).* |\n| [MockService](/reference/android/test/mock/MockService) | *This class was deprecated in API level 28. Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](/tools/testing-support-library).* |\n\n-\n\n Classes\n -------\n\n - [MockAccountManager](/reference/android/test/mock/MockAccountManager)\n - [MockApplication](/reference/android/test/mock/MockApplication)\n - [MockContentProvider](/reference/android/test/mock/MockContentProvider)\n - [MockContentResolver](/reference/android/test/mock/MockContentResolver)\n - [MockContext](/reference/android/test/mock/MockContext)\n - [MockCursor](/reference/android/test/mock/MockCursor)\n - [MockDialogInterface](/reference/android/test/mock/MockDialogInterface)\n - [MockPackageManager](/reference/android/test/mock/MockPackageManager)\n - [MockResources](/reference/android/test/mock/MockResources)\n - [MockService](/reference/android/test/mock/MockService)"]]