Class MockSpeechConnection (2.28.0)

A class to mock SpeechConnection.

Application developers may want to test their code with simulated responses, including errors, from an object of type SpeechClient. To do so, construct an object of type SpeechClient 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 CreateRecognizer(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::speech::v2::Recognizer > >

virtual ListRecognizers(google::cloud::speech::v2::ListRecognizersRequest)

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::speech::v2::ListRecognizersRequest
Returns
Type Description
StreamRange< google::cloud::speech::v2::Recognizer >

virtual GetRecognizer(google::cloud::speech::v2::GetRecognizerRequest 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::speech::v2::GetRecognizerRequest const &
Returns
Type Description
StatusOr< google::cloud::speech::v2::Recognizer >

virtual UpdateRecognizer(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::speech::v2::Recognizer > >

virtual DeleteRecognizer(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::speech::v2::Recognizer > >

virtual UndeleteRecognizer(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::speech::v2::Recognizer > >

virtual Recognize(google::cloud::speech::v2::RecognizeRequest 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::speech::v2::RecognizeRequest const &
Returns
Type Description
StatusOr< google::cloud::speech::v2::RecognizeResponse >

virtual AsyncStreamingRecognize()

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Returns
Type Description
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc< google::cloud::speech::v2::StreamingRecognizeRequest, google::cloud::speech::v2::StreamingRecognizeResponse > >

virtual BatchRecognize(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::speech::v2::BatchRecognizeResponse > >

virtual GetConfig(google::cloud::speech::v2::GetConfigRequest 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::speech::v2::GetConfigRequest const &
Returns
Type Description
StatusOr< google::cloud::speech::v2::Config >

virtual UpdateConfig(google::cloud::speech::v2::UpdateConfigRequest 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::speech::v2::UpdateConfigRequest const &
Returns
Type Description
StatusOr< google::cloud::speech::v2::Config >

virtual CreateCustomClass(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::speech::v2::CustomClass > >

virtual ListCustomClasses(google::cloud::speech::v2::ListCustomClassesRequest)

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::speech::v2::ListCustomClassesRequest
Returns
Type Description
StreamRange< google::cloud::speech::v2::CustomClass >

virtual GetCustomClass(google::cloud::speech::v2::GetCustomClassRequest 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::speech::v2::GetCustomClassRequest const &
Returns
Type Description
StatusOr< google::cloud::speech::v2::CustomClass >

virtual UpdateCustomClass(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::speech::v2::CustomClass > >

virtual DeleteCustomClass(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::speech::v2::CustomClass > >

virtual UndeleteCustomClass(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::speech::v2::CustomClass > >

virtual CreatePhraseSet(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::speech::v2::PhraseSet > >

virtual ListPhraseSets(google::cloud::speech::v2::ListPhraseSetsRequest)

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::speech::v2::ListPhraseSetsRequest
Returns
Type Description
StreamRange< google::cloud::speech::v2::PhraseSet >

virtual GetPhraseSet(google::cloud::speech::v2::GetPhraseSetRequest 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::speech::v2::GetPhraseSetRequest const &
Returns
Type Description
StatusOr< google::cloud::speech::v2::PhraseSet >

virtual UpdatePhraseSet(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::speech::v2::PhraseSet > >

virtual DeletePhraseSet(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::speech::v2::PhraseSet > >

virtual UndeletePhraseSet(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::speech::v2::PhraseSet > >