Stay organized with collections
Save and categorize content based on your preferences.
MockAccountManager
open class MockAccountManager
A mock android.accounts.AccountManager
class.
Provided for use by android.test.IsolatedContext
.
Summary
Public methods
newMockAccountManager
open static fun newMockAccountManager(context: Context!): AccountManager!
Deprecated: Deprecated in Java.
Create a new mock AccountManager
instance.
Parameters |
context |
Context!: the Context to which the returned object belongs. |
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,["# MockAccountManager\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nMockAccountManager\n==================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/test/mock/MockAccountManager \"View this page in Java\") \n\n```\nopen class MockAccountManager\n```\n\n|---|-------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.test.mock.MockAccountManager](#) |\n\n*** ** * ** ***\n\n| **This class was deprecated in API level 28.**\n|\n| Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](https://developer.android.com/\n| tools/testing-support-library/index.html).\n\nA mock [android.accounts.AccountManager](../../accounts/AccountManager.html#) class.\n\nProvided for use by `android.test.IsolatedContext`.\n\nSummary\n-------\n\n| Public methods ||\n|--------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open static [AccountManager](../../accounts/AccountManager.html#)! | [newMockAccountManager](#newMockAccountManager(android.content.Context))`(`context:` `[Context](../../content/Context.html#)!`)` Create a new mock [AccountManager](../../accounts/AccountManager.html#) instance. |\n\nPublic methods\n--------------\n\n### newMockAccountManager\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen static fun newMockAccountManager(context: Context!): AccountManager!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nCreate a new mock [AccountManager](../../accounts/AccountManager.html#) instance.\n\n| Parameters ||\n|-----------|---------------------------------------------------------------------------------------------------------------------------|\n| `context` | [Context](../../content/Context.html#)!: the [Context](../../content/Context.html#) to which the returned object belongs. |\n\n| Return ||\n|--------------------------------------------------------|-------------------|\n| [AccountManager](../../accounts/AccountManager.html#)! | the new instance. |"]]