Namespace google::cloud::mocks (2.46.0-rc) Stay organized with collections Save and categorize content based on your preferences.
Contains helpers for testing the Google Cloud C++ Client Libraries.
The symbols defined in this namespace are part ofgoogle-cloud-cpp's public API. Application developers may use them when mocking the client libraries in their own tests.
Classes
MockAsyncStreamingReadWriteRpc<RequestType, ResponseType>
Functions
CurrentOptions()
Retrieve options used in a client call.
This would be used to verify configuration options from within a MockConnection. It provides a way for applications to test the difference betweenclient.Foo(request, options) andclient.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);}| Returns | |
|---|---|
| Type | Description |
Options const & | |
MakeStreamRange(std::vector< T >, Status)
Construct aStreamRange<T> for use in tests.
auto sr = MakeStreamRange<T>({t1, t2});for (StatusOr<T> const& t : sr) { // Yields t1 -> t2}sr = MakeStreamRange<T>({t1, t2}, BadStatus());for (StatusOr<T> const& t : sr) { // Yields t1 -> t2 -> BadStatus()}| Parameters | |
|---|---|
| Name | Description |
values | std::vector< T >The successfully returned |
final_status | Status |
typename T | |
| Returns | |
|---|---|
| Type | Description |
StreamRange< T > | |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-17 UTC.