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"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-05 UTC."],[[["This document provides access to various versions of the `google-cloud-cpp` library, ranging from version 2.10.1 to the latest release candidate 2.37.0-rc."],["The content describes a namespace (`google::cloud::mocks`) within the library that offers tools and helpers designed to aid in testing Google Cloud C++ Client Libraries."],["The `CurrentOptions()` function allows users to retrieve and verify configuration options utilized within a client call, which is particularly useful for testing."],["The `MakeStreamRange()` function facilitates the creation of a `StreamRange\u003cT\u003e` for use in tests, allowing for the simulation of various stream scenarios with different statuses."],["The `MockAsyncStreamingReadWriteRpc\u003cRequestType, ResponseType\u003e` class is included as a resource for mocking asynchronous streaming read/write RPCs."]]],[]]