Contains helpers for testing the Google Cloud C++ Client Libraries.
The symbols defined in this namespace are part of google-cloud-cpp's public API. Application developers may use them when mocking the client libraries in their own tests.
This would be used to verify configuration options from within a MockConnection. It provides a way for applications to test the difference between client.Foo(request, options) and client.Foo(request).
TEST(Foo, CallOptions) {
auto mock = std::make_shared<MockConnection>();
EXPECT_CALL(*mock, Foo).WillOnce([] {
auto const& options = google::cloud::mocks::CurrentOptions();
EXPECT_THAT(options, ...);
});
auto client = Client(mock);
MyFunctionThatCallsFoo(client);
}
[[["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-07-02 UTC."],[[["This document details the `google::cloud::mocks` namespace, which provides testing helpers for the Google Cloud C++ Client Libraries."],["The latest version available is `2.37.0-rc`, but many previous versions from `2.36.0` to `2.10.1` are documented here."],["The `CurrentOptions()` function is used to retrieve the options used in a client call, helping verify configurations during tests within a `MockConnection`."],["The `MakeStreamRange` function is used to create a `StreamRange\u003cT\u003e` for tests, allowing specification of successful return values and a final status."],["The documentation includes information on the `MockAsyncStreamingReadWriteRpc` class, alongside the functions `CurrentOptions()` and `MakeStreamRange(std::vector\u003cT\u003e, Status)`."]]],[]]