A class to mock AppHubConnection
.
Application developers may want to test their code with simulated responses, including errors, from an object of type AppHubClient
. To do so, construct an object of type AppHubClient
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.
Returns |
Type |
Description |
Options |
|
virtual LookupServiceProjectAttachment(google::cloud::apphub::v1::LookupServiceProjectAttachmentRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::LookupServiceProjectAttachmentRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::LookupServiceProjectAttachmentResponse > |
|
virtual ListServiceProjectAttachments(google::cloud::apphub::v1::ListServiceProjectAttachmentsRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::ListServiceProjectAttachmentsRequest
|
Returns |
Type |
Description |
StreamRange< google::cloud::apphub::v1::ServiceProjectAttachment > |
|
virtual CreateServiceProjectAttachment(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::ServiceProjectAttachment > > |
|
virtual GetServiceProjectAttachment(google::cloud::apphub::v1::GetServiceProjectAttachmentRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::GetServiceProjectAttachmentRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::ServiceProjectAttachment > |
|
virtual DeleteServiceProjectAttachment(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::OperationMetadata > > |
|
virtual DetachServiceProjectAttachment(google::cloud::apphub::v1::DetachServiceProjectAttachmentRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::DetachServiceProjectAttachmentRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::DetachServiceProjectAttachmentResponse > |
|
virtual ListDiscoveredServices(google::cloud::apphub::v1::ListDiscoveredServicesRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::ListDiscoveredServicesRequest
|
Returns |
Type |
Description |
StreamRange< google::cloud::apphub::v1::DiscoveredService > |
|
virtual GetDiscoveredService(google::cloud::apphub::v1::GetDiscoveredServiceRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::GetDiscoveredServiceRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::DiscoveredService > |
|
virtual LookupDiscoveredService(google::cloud::apphub::v1::LookupDiscoveredServiceRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::LookupDiscoveredServiceRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::LookupDiscoveredServiceResponse > |
|
virtual ListServices(google::cloud::apphub::v1::ListServicesRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::ListServicesRequest
|
Returns |
Type |
Description |
StreamRange< google::cloud::apphub::v1::Service > |
|
virtual CreateService(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::Service > > |
|
virtual GetService(google::cloud::apphub::v1::GetServiceRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::GetServiceRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::Service > |
|
virtual UpdateService(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::Service > > |
|
virtual DeleteService(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::OperationMetadata > > |
|
virtual ListDiscoveredWorkloads(google::cloud::apphub::v1::ListDiscoveredWorkloadsRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::ListDiscoveredWorkloadsRequest
|
Returns |
Type |
Description |
StreamRange< google::cloud::apphub::v1::DiscoveredWorkload > |
|
virtual GetDiscoveredWorkload(google::cloud::apphub::v1::GetDiscoveredWorkloadRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::GetDiscoveredWorkloadRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::DiscoveredWorkload > |
|
virtual LookupDiscoveredWorkload(google::cloud::apphub::v1::LookupDiscoveredWorkloadRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::LookupDiscoveredWorkloadRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::LookupDiscoveredWorkloadResponse > |
|
virtual ListWorkloads(google::cloud::apphub::v1::ListWorkloadsRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::ListWorkloadsRequest
|
Returns |
Type |
Description |
StreamRange< google::cloud::apphub::v1::Workload > |
|
virtual CreateWorkload(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::Workload > > |
|
virtual GetWorkload(google::cloud::apphub::v1::GetWorkloadRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::GetWorkloadRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::Workload > |
|
virtual UpdateWorkload(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::Workload > > |
|
virtual DeleteWorkload(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::OperationMetadata > > |
|
virtual ListApplications(google::cloud::apphub::v1::ListApplicationsRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::ListApplicationsRequest
|
Returns |
Type |
Description |
StreamRange< google::cloud::apphub::v1::Application > |
|
virtual CreateApplication(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::Application > > |
|
virtual GetApplication(google::cloud::apphub::v1::GetApplicationRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::apphub::v1::GetApplicationRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::apphub::v1::Application > |
|
virtual UpdateApplication(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::Application > > |
|
virtual DeleteApplication(google::longrunning::Operation const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
operation |
google::longrunning::Operation const &
|
Returns |
Type |
Description |
future< StatusOr< google::cloud::apphub::v1::OperationMetadata > > |
|
virtual ListLocations(google::cloud::location::ListLocationsRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::location::ListLocationsRequest
|
Returns |
Type |
Description |
StreamRange< google::cloud::location::Location > |
|
virtual GetLocation(google::cloud::location::GetLocationRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::cloud::location::GetLocationRequest const &
|
Returns |
Type |
Description |
StatusOr< google::cloud::location::Location > |
|
virtual SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::v1::SetIamPolicyRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::v1::Policy > |
|
virtual GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::v1::GetIamPolicyRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::v1::Policy > |
|
virtual TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::v1::TestIamPermissionsRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::v1::TestIamPermissionsResponse > |
|
virtual ListOperations(google::longrunning::ListOperationsRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::longrunning::ListOperationsRequest
|
Returns |
Type |
Description |
StreamRange< google::longrunning::Operation > |
|
virtual GetOperation(google::longrunning::GetOperationRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::longrunning::GetOperationRequest const &
|
Returns |
Type |
Description |
StatusOr< google::longrunning::Operation > |
|
virtual DeleteOperation(google::longrunning::DeleteOperationRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::longrunning::DeleteOperationRequest const &
|
Returns |
Type |
Description |
Status |
|
virtual CancelOperation(google::longrunning::CancelOperationRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::longrunning::CancelOperationRequest const &
|
Returns |
Type |
Description |
Status |
|