Application developers may want to test their code with simulated responses, including errors, from an object of type DatabaseAdminClient. To do so, construct an object of type DatabaseAdminClient with an instance of this class. Then use the Google Test framework functions to program the behavior of this mock.
See Also
This example for how to test your application with GoogleTest. While the example showcases types from the BigQuery library, the underlying principles apply for any pair of *Client and *Connection.
Functions
virtual options()
This function is implemented using gMock's MOCK_METHOD().
Consult the gMock documentation to use this mock in your tests.
[[["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-22 UTC."],[[["\u003cp\u003eThis webpage details the \u003ccode\u003eMockDatabaseAdminConnection\u003c/code\u003e class, which is designed to facilitate testing of applications interacting with \u003ccode\u003eDatabaseAdminClient\u003c/code\u003e by simulating responses and behaviors.\u003c/p\u003e\n"],["\u003cp\u003eThe class utilizes gMock's \u003ccode\u003eMOCK_METHOD()\u003c/code\u003e for its functions, allowing users to program the mock's behavior using the Google Test framework, and enabling the mocking of various database operations such as creating, updating, and listing databases.\u003c/p\u003e\n"],["\u003cp\u003eThe page outlines various functions that are part of the \u003ccode\u003eMockDatabaseAdminConnection\u003c/code\u003e class, including \u003ccode\u003eoptions()\u003c/code\u003e, \u003ccode\u003eListDatabases()\u003c/code\u003e, \u003ccode\u003eCreateDatabase()\u003c/code\u003e, \u003ccode\u003eGetDatabase()\u003c/code\u003e, and many others, each offering specific functionalities for database administration mocking.\u003c/p\u003e\n"],["\u003cp\u003eThere is a comprehensive list of versions of the \u003ccode\u003eMockDatabaseAdminConnection\u003c/code\u003e, from version 2.11.0 to version 2.37.0-rc (latest), allowing users to find the proper version of this documentation if they need it.\u003c/p\u003e\n"],["\u003cp\u003eThe provided example from the BigQuery library demonstrates how to test applications using this \u003ccode\u003eMockDatabaseAdminConnection\u003c/code\u003e class in conjunction with the GoogleTest framework, and explains that this approach is applicable to any \u003ccode\u003e*Client\u003c/code\u003e and \u003ccode\u003e*Connection\u003c/code\u003e pair.\u003c/p\u003e\n"]]],[],null,[]]