Class MockTranslationServiceConnection (2.15.1)
Note: Some or all of the information on this page might not apply
to Trusted Cloud. For a list of services that are available in
Trusted Cloud, see Services available for
Trusted Cloud .
Version 2.15.1keyboard_arrow_down
A class to mock TranslationServiceConnection
.
Application developers may want to test their code with simulated responses, including errors, from an object of type TranslationServiceClient
. To do so, construct an object of type TranslationServiceClient
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 TranslateText(google::cloud::translation::v3::TranslateTextRequest 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::translation::v3::TranslateTextRequest const &
Returns
Type
Description
StatusOr< google::cloud::translation::v3::TranslateTextResponse >
virtual DetectLanguage(google::cloud::translation::v3::DetectLanguageRequest 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::translation::v3::DetectLanguageRequest const &
Returns
Type
Description
StatusOr< google::cloud::translation::v3::DetectLanguageResponse >
virtual GetSupportedLanguages(google::cloud::translation::v3::GetSupportedLanguagesRequest 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::translation::v3::GetSupportedLanguagesRequest const &
Returns
Type
Description
StatusOr< google::cloud::translation::v3::SupportedLanguages >
virtual TranslateDocument(google::cloud::translation::v3::TranslateDocumentRequest 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::translation::v3::TranslateDocumentRequest const &
Returns
Type
Description
StatusOr< google::cloud::translation::v3::TranslateDocumentResponse >
virtual BatchTranslateText(google::cloud::translation::v3::BatchTranslateTextRequest 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::translation::v3::BatchTranslateTextRequest const &
Returns
Type
Description
future< StatusOr< google::cloud::translation::v3::BatchTranslateResponse > >
virtual BatchTranslateDocument(google::cloud::translation::v3::BatchTranslateDocumentRequest 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::translation::v3::BatchTranslateDocumentRequest const &
Returns
Type
Description
future< StatusOr< google::cloud::translation::v3::BatchTranslateDocumentResponse > >
virtual CreateGlossary(google::cloud::translation::v3::CreateGlossaryRequest 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::translation::v3::CreateGlossaryRequest const &
Returns
Type
Description
future< StatusOr< google::cloud::translation::v3::Glossary > >
virtual ListGlossaries(google::cloud::translation::v3::ListGlossariesRequest)
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::translation::v3::ListGlossariesRequest
Returns
Type
Description
StreamRange< google::cloud::translation::v3::Glossary >
virtual GetGlossary(google::cloud::translation::v3::GetGlossaryRequest 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::translation::v3::GetGlossaryRequest const &
Returns
Type
Description
StatusOr< google::cloud::translation::v3::Glossary >
virtual DeleteGlossary(google::cloud::translation::v3::DeleteGlossaryRequest 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::translation::v3::DeleteGlossaryRequest const &
Returns
Type
Description
future< StatusOr< google::cloud::translation::v3::DeleteGlossaryResponse > >
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-02 UTC.
[[["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-10-02 UTC."],[],[]]