Class MockTranslationServiceConnection (2.29.0)

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 RomanizeText(google::cloud::translation::v3::RomanizeTextRequest 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::RomanizeTextRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::RomanizeTextResponse >

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::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::translation::v3::BatchTranslateResponse > >

virtual BatchTranslateDocument(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::translation::v3::BatchTranslateDocumentResponse > >

virtual CreateGlossary(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::translation::v3::Glossary > >

virtual UpdateGlossary(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::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::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::translation::v3::DeleteGlossaryResponse > >

virtual GetGlossaryEntry(google::cloud::translation::v3::GetGlossaryEntryRequest 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::GetGlossaryEntryRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::GlossaryEntry >

virtual ListGlossaryEntries(google::cloud::translation::v3::ListGlossaryEntriesRequest)

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::ListGlossaryEntriesRequest
Returns
Type Description
StreamRange< google::cloud::translation::v3::GlossaryEntry >

virtual CreateGlossaryEntry(google::cloud::translation::v3::CreateGlossaryEntryRequest 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::CreateGlossaryEntryRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::GlossaryEntry >

virtual UpdateGlossaryEntry(google::cloud::translation::v3::UpdateGlossaryEntryRequest 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::UpdateGlossaryEntryRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::GlossaryEntry >

virtual DeleteGlossaryEntry(google::cloud::translation::v3::DeleteGlossaryEntryRequest 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::DeleteGlossaryEntryRequest const &
Returns
Type Description
Status

virtual CreateDataset(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::translation::v3::Dataset > >

virtual GetDataset(google::cloud::translation::v3::GetDatasetRequest 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::GetDatasetRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::Dataset >

virtual ListDatasets(google::cloud::translation::v3::ListDatasetsRequest)

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::ListDatasetsRequest
Returns
Type Description
StreamRange< google::cloud::translation::v3::Dataset >

virtual DeleteDataset(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::translation::v3::DeleteDatasetMetadata > >

virtual CreateAdaptiveMtDataset(google::cloud::translation::v3::CreateAdaptiveMtDatasetRequest 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::CreateAdaptiveMtDatasetRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::AdaptiveMtDataset >

virtual DeleteAdaptiveMtDataset(google::cloud::translation::v3::DeleteAdaptiveMtDatasetRequest 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::DeleteAdaptiveMtDatasetRequest const &
Returns
Type Description
Status

virtual GetAdaptiveMtDataset(google::cloud::translation::v3::GetAdaptiveMtDatasetRequest 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::GetAdaptiveMtDatasetRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::AdaptiveMtDataset >

virtual ListAdaptiveMtDatasets(google::cloud::translation::v3::ListAdaptiveMtDatasetsRequest)

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::ListAdaptiveMtDatasetsRequest
Returns
Type Description
StreamRange< google::cloud::translation::v3::AdaptiveMtDataset >

virtual AdaptiveMtTranslate(google::cloud::translation::v3::AdaptiveMtTranslateRequest 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::AdaptiveMtTranslateRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::AdaptiveMtTranslateResponse >

virtual GetAdaptiveMtFile(google::cloud::translation::v3::GetAdaptiveMtFileRequest 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::GetAdaptiveMtFileRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::AdaptiveMtFile >

virtual DeleteAdaptiveMtFile(google::cloud::translation::v3::DeleteAdaptiveMtFileRequest 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::DeleteAdaptiveMtFileRequest const &
Returns
Type Description
Status

virtual ImportAdaptiveMtFile(google::cloud::translation::v3::ImportAdaptiveMtFileRequest 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::ImportAdaptiveMtFileRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::ImportAdaptiveMtFileResponse >

virtual ListAdaptiveMtFiles(google::cloud::translation::v3::ListAdaptiveMtFilesRequest)

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::ListAdaptiveMtFilesRequest
Returns
Type Description
StreamRange< google::cloud::translation::v3::AdaptiveMtFile >

virtual ListAdaptiveMtSentences(google::cloud::translation::v3::ListAdaptiveMtSentencesRequest)

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::ListAdaptiveMtSentencesRequest
Returns
Type Description
StreamRange< google::cloud::translation::v3::AdaptiveMtSentence >

virtual ImportData(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::translation::v3::ImportDataMetadata > >

virtual ExportData(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::translation::v3::ExportDataMetadata > >

virtual ListExamples(google::cloud::translation::v3::ListExamplesRequest)

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::ListExamplesRequest
Returns
Type Description
StreamRange< google::cloud::translation::v3::Example >

virtual CreateModel(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::translation::v3::Model > >

virtual ListModels(google::cloud::translation::v3::ListModelsRequest)

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::ListModelsRequest
Returns
Type Description
StreamRange< google::cloud::translation::v3::Model >

virtual GetModel(google::cloud::translation::v3::GetModelRequest 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::GetModelRequest const &
Returns
Type Description
StatusOr< google::cloud::translation::v3::Model >

virtual DeleteModel(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::translation::v3::DeleteModelMetadata > >