def annotate_text(self, document, features, encoding_type, options=None):
        """
        A convenience method that provides all the features that analyzeSentiment,
        analyzeEntities, and analyzeSyntax provide in one call.

        Example:
          >>> from google.cloud.gapic.language.v1 import language_service_client
          >>> from google.cloud.gapic.language.v1 import enums
          >>> from google.cloud.proto.language.v1 import language_service_pb2
          >>> client = language_service_client.LanguageServiceClient()
          >>> document = language_service_pb2.Document()
          >>> features = language_service_pb2.AnnotateTextRequest.Features()
          >>> encoding_type = enums.EncodingType.NONE
          >>> response = client.annotate_text(document, features, encoding_type)

        Args:
          document (:class:`google.cloud.proto.language.v1.language_service_pb2.Document`): Input document.
          features (:class:`google.cloud.proto.language.v1.language_service_pb2.AnnotateTextRequest.Features`): The enabled features.
          encoding_type (enum :class:`google.cloud.gapic.language.v1.enums.EncodingType`): The encoding type used by the API to calculate offsets.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Returns:
          A :class:`google.cloud.proto.language.v1.language_service_pb2.AnnotateTextResponse` instance.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = language_service_pb2.AnnotateTextRequest(
            document=document, features=features, encoding_type=encoding_type)
        return self._annotate_text(request, options)
    def test_annotate_text(self, mock_create_stub):
        # Mock gRPC layer
        grpc_stub = mock.Mock()
        mock_create_stub.return_value = grpc_stub

        client = language_service_client.LanguageServiceClient()

        # Mock request
        document = language_service_pb2.Document()
        features = language_service_pb2.AnnotateTextRequest.Features()

        # Mock response
        language = 'language-1613589672'
        expected_response = language_service_pb2.AnnotateTextResponse(
            language=language)
        grpc_stub.AnnotateText.return_value = expected_response

        response = client.annotate_text(document, features)
        self.assertEqual(expected_response, response)

        grpc_stub.AnnotateText.assert_called_once()
        args, kwargs = grpc_stub.AnnotateText.call_args
        self.assertEqual(len(args), 2)
        self.assertEqual(len(kwargs), 1)
        self.assertIn('metadata', kwargs)
        actual_request = args[0]

        expected_request = language_service_pb2.AnnotateTextRequest(
            document=document, features=features)
        self.assertEqual(expected_request, actual_request)