# frozen_string_literal: true

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Auto-generated by gapic-generator-ruby. DO NOT EDIT!

require "helper"

require "gapic/grpc/service_stub"

require "google/cloud/vmmigration/v1/vmmigration_pb"
require "google/cloud/vmmigration/v1/vmmigration_services_pb"
require "google/cloud/vm_migration/v1/vm_migration"

class ::Google::Cloud::VMMigration::V1::VMMigration::ClientTest < Minitest::Test
  class ClientStub
    attr_accessor :call_rpc_count, :requests

    def initialize response, operation, &block
      @response = response
      @operation = operation
      @block = block
      @call_rpc_count = 0
      @requests = []
    end

    def call_rpc *args, **kwargs
      @call_rpc_count += 1

      @requests << @block&.call(*args, **kwargs)

      yield @response, @operation if block_given?

      @response
    end
  end

  def test_list_sources
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::ListSourcesResponse.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    page_size = 42
    page_token = "hello world"
    filter = "hello world"
    order_by = "hello world"

    list_sources_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :list_sources, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::ListSourcesRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal 42, request["page_size"]
      assert_equal "hello world", request["page_token"]
      assert_equal "hello world", request["filter"]
      assert_equal "hello world", request["order_by"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, list_sources_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.list_sources({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.list_sources parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.list_sources ::Google::Cloud::VMMigration::V1::ListSourcesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.list_sources({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.list_sources(::Google::Cloud::VMMigration::V1::ListSourcesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, list_sources_client_stub.call_rpc_count
    end
  end

  def test_get_source
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::Source.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    get_source_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :get_source, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::GetSourceRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, get_source_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.get_source({ name: name }) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.get_source name: name do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.get_source ::Google::Cloud::VMMigration::V1::GetSourceRequest.new(name: name) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.get_source({ name: name }, grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.get_source(::Google::Cloud::VMMigration::V1::GetSourceRequest.new(name: name), grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, get_source_client_stub.call_rpc_count
    end
  end

  def test_create_source
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    source_id = "hello world"
    source = {}
    request_id = "hello world"

    create_source_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :create_source, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CreateSourceRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal "hello world", request["source_id"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::Source), request["source"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, create_source_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.create_source({ parent: parent, source_id: source_id, source: source, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.create_source parent: parent, source_id: source_id, source: source, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.create_source ::Google::Cloud::VMMigration::V1::CreateSourceRequest.new(parent: parent, source_id: source_id, source: source, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.create_source({ parent: parent, source_id: source_id, source: source, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.create_source(::Google::Cloud::VMMigration::V1::CreateSourceRequest.new(parent: parent, source_id: source_id, source: source, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, create_source_client_stub.call_rpc_count
    end
  end

  def test_update_source
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    update_mask = {}
    source = {}
    request_id = "hello world"

    update_source_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :update_source, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::UpdateSourceRequest, request
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::Source), request["source"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, update_source_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.update_source({ update_mask: update_mask, source: source, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.update_source update_mask: update_mask, source: source, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.update_source ::Google::Cloud::VMMigration::V1::UpdateSourceRequest.new(update_mask: update_mask, source: source, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.update_source({ update_mask: update_mask, source: source, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.update_source(::Google::Cloud::VMMigration::V1::UpdateSourceRequest.new(update_mask: update_mask, source: source, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, update_source_client_stub.call_rpc_count
    end
  end

  def test_delete_source
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"
    request_id = "hello world"

    delete_source_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :delete_source, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::DeleteSourceRequest, request
      assert_equal "hello world", request["name"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, delete_source_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.delete_source({ name: name, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.delete_source name: name, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.delete_source ::Google::Cloud::VMMigration::V1::DeleteSourceRequest.new(name: name, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.delete_source({ name: name, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.delete_source(::Google::Cloud::VMMigration::V1::DeleteSourceRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, delete_source_client_stub.call_rpc_count
    end
  end

  def test_fetch_inventory
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::FetchInventoryResponse.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    source = "hello world"
    force_refresh = true

    fetch_inventory_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :fetch_inventory, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::FetchInventoryRequest, request
      assert_equal "hello world", request["source"]
      assert_equal true, request["force_refresh"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, fetch_inventory_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.fetch_inventory({ source: source, force_refresh: force_refresh }) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.fetch_inventory source: source, force_refresh: force_refresh do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.fetch_inventory ::Google::Cloud::VMMigration::V1::FetchInventoryRequest.new(source: source, force_refresh: force_refresh) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.fetch_inventory({ source: source, force_refresh: force_refresh }, grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.fetch_inventory(::Google::Cloud::VMMigration::V1::FetchInventoryRequest.new(source: source, force_refresh: force_refresh), grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, fetch_inventory_client_stub.call_rpc_count
    end
  end

  def test_list_utilization_reports
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::ListUtilizationReportsResponse.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    view = :UTILIZATION_REPORT_VIEW_UNSPECIFIED
    page_size = 42
    page_token = "hello world"
    filter = "hello world"
    order_by = "hello world"

    list_utilization_reports_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :list_utilization_reports, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::ListUtilizationReportsRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal :UTILIZATION_REPORT_VIEW_UNSPECIFIED, request["view"]
      assert_equal 42, request["page_size"]
      assert_equal "hello world", request["page_token"]
      assert_equal "hello world", request["filter"]
      assert_equal "hello world", request["order_by"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, list_utilization_reports_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.list_utilization_reports({ parent: parent, view: view, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.list_utilization_reports parent: parent, view: view, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.list_utilization_reports ::Google::Cloud::VMMigration::V1::ListUtilizationReportsRequest.new(parent: parent, view: view, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.list_utilization_reports({ parent: parent, view: view, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.list_utilization_reports(::Google::Cloud::VMMigration::V1::ListUtilizationReportsRequest.new(parent: parent, view: view, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, list_utilization_reports_client_stub.call_rpc_count
    end
  end

  def test_get_utilization_report
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::UtilizationReport.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"
    view = :UTILIZATION_REPORT_VIEW_UNSPECIFIED

    get_utilization_report_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :get_utilization_report, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::GetUtilizationReportRequest, request
      assert_equal "hello world", request["name"]
      assert_equal :UTILIZATION_REPORT_VIEW_UNSPECIFIED, request["view"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, get_utilization_report_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.get_utilization_report({ name: name, view: view }) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.get_utilization_report name: name, view: view do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.get_utilization_report ::Google::Cloud::VMMigration::V1::GetUtilizationReportRequest.new(name: name, view: view) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.get_utilization_report({ name: name, view: view }, grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.get_utilization_report(::Google::Cloud::VMMigration::V1::GetUtilizationReportRequest.new(name: name, view: view), grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, get_utilization_report_client_stub.call_rpc_count
    end
  end

  def test_create_utilization_report
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    utilization_report = {}
    utilization_report_id = "hello world"
    request_id = "hello world"

    create_utilization_report_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :create_utilization_report, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CreateUtilizationReportRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::UtilizationReport), request["utilization_report"]
      assert_equal "hello world", request["utilization_report_id"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, create_utilization_report_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.create_utilization_report({ parent: parent, utilization_report: utilization_report, utilization_report_id: utilization_report_id, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.create_utilization_report parent: parent, utilization_report: utilization_report, utilization_report_id: utilization_report_id, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.create_utilization_report ::Google::Cloud::VMMigration::V1::CreateUtilizationReportRequest.new(parent: parent, utilization_report: utilization_report, utilization_report_id: utilization_report_id, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.create_utilization_report({ parent: parent, utilization_report: utilization_report, utilization_report_id: utilization_report_id, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.create_utilization_report(::Google::Cloud::VMMigration::V1::CreateUtilizationReportRequest.new(parent: parent, utilization_report: utilization_report, utilization_report_id: utilization_report_id, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, create_utilization_report_client_stub.call_rpc_count
    end
  end

  def test_delete_utilization_report
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"
    request_id = "hello world"

    delete_utilization_report_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :delete_utilization_report, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::DeleteUtilizationReportRequest, request
      assert_equal "hello world", request["name"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, delete_utilization_report_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.delete_utilization_report({ name: name, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.delete_utilization_report name: name, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.delete_utilization_report ::Google::Cloud::VMMigration::V1::DeleteUtilizationReportRequest.new(name: name, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.delete_utilization_report({ name: name, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.delete_utilization_report(::Google::Cloud::VMMigration::V1::DeleteUtilizationReportRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, delete_utilization_report_client_stub.call_rpc_count
    end
  end

  def test_list_datacenter_connectors
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::ListDatacenterConnectorsResponse.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    page_size = 42
    page_token = "hello world"
    filter = "hello world"
    order_by = "hello world"

    list_datacenter_connectors_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :list_datacenter_connectors, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::ListDatacenterConnectorsRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal 42, request["page_size"]
      assert_equal "hello world", request["page_token"]
      assert_equal "hello world", request["filter"]
      assert_equal "hello world", request["order_by"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, list_datacenter_connectors_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.list_datacenter_connectors({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.list_datacenter_connectors parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.list_datacenter_connectors ::Google::Cloud::VMMigration::V1::ListDatacenterConnectorsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.list_datacenter_connectors({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.list_datacenter_connectors(::Google::Cloud::VMMigration::V1::ListDatacenterConnectorsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, list_datacenter_connectors_client_stub.call_rpc_count
    end
  end

  def test_get_datacenter_connector
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::DatacenterConnector.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    get_datacenter_connector_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :get_datacenter_connector, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::GetDatacenterConnectorRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, get_datacenter_connector_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.get_datacenter_connector({ name: name }) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.get_datacenter_connector name: name do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.get_datacenter_connector ::Google::Cloud::VMMigration::V1::GetDatacenterConnectorRequest.new(name: name) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.get_datacenter_connector({ name: name }, grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.get_datacenter_connector(::Google::Cloud::VMMigration::V1::GetDatacenterConnectorRequest.new(name: name), grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, get_datacenter_connector_client_stub.call_rpc_count
    end
  end

  def test_create_datacenter_connector
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    datacenter_connector_id = "hello world"
    datacenter_connector = {}
    request_id = "hello world"

    create_datacenter_connector_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :create_datacenter_connector, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CreateDatacenterConnectorRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal "hello world", request["datacenter_connector_id"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::DatacenterConnector), request["datacenter_connector"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, create_datacenter_connector_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.create_datacenter_connector({ parent: parent, datacenter_connector_id: datacenter_connector_id, datacenter_connector: datacenter_connector, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.create_datacenter_connector parent: parent, datacenter_connector_id: datacenter_connector_id, datacenter_connector: datacenter_connector, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.create_datacenter_connector ::Google::Cloud::VMMigration::V1::CreateDatacenterConnectorRequest.new(parent: parent, datacenter_connector_id: datacenter_connector_id, datacenter_connector: datacenter_connector, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.create_datacenter_connector({ parent: parent, datacenter_connector_id: datacenter_connector_id, datacenter_connector: datacenter_connector, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.create_datacenter_connector(::Google::Cloud::VMMigration::V1::CreateDatacenterConnectorRequest.new(parent: parent, datacenter_connector_id: datacenter_connector_id, datacenter_connector: datacenter_connector, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, create_datacenter_connector_client_stub.call_rpc_count
    end
  end

  def test_delete_datacenter_connector
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"
    request_id = "hello world"

    delete_datacenter_connector_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :delete_datacenter_connector, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::DeleteDatacenterConnectorRequest, request
      assert_equal "hello world", request["name"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, delete_datacenter_connector_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.delete_datacenter_connector({ name: name, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.delete_datacenter_connector name: name, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.delete_datacenter_connector ::Google::Cloud::VMMigration::V1::DeleteDatacenterConnectorRequest.new(name: name, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.delete_datacenter_connector({ name: name, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.delete_datacenter_connector(::Google::Cloud::VMMigration::V1::DeleteDatacenterConnectorRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, delete_datacenter_connector_client_stub.call_rpc_count
    end
  end

  def test_create_migrating_vm
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    migrating_vm_id = "hello world"
    migrating_vm = {}
    request_id = "hello world"

    create_migrating_vm_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :create_migrating_vm, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CreateMigratingVmRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal "hello world", request["migrating_vm_id"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::MigratingVm), request["migrating_vm"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, create_migrating_vm_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.create_migrating_vm({ parent: parent, migrating_vm_id: migrating_vm_id, migrating_vm: migrating_vm, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.create_migrating_vm parent: parent, migrating_vm_id: migrating_vm_id, migrating_vm: migrating_vm, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.create_migrating_vm ::Google::Cloud::VMMigration::V1::CreateMigratingVmRequest.new(parent: parent, migrating_vm_id: migrating_vm_id, migrating_vm: migrating_vm, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.create_migrating_vm({ parent: parent, migrating_vm_id: migrating_vm_id, migrating_vm: migrating_vm, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.create_migrating_vm(::Google::Cloud::VMMigration::V1::CreateMigratingVmRequest.new(parent: parent, migrating_vm_id: migrating_vm_id, migrating_vm: migrating_vm, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, create_migrating_vm_client_stub.call_rpc_count
    end
  end

  def test_list_migrating_vms
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::ListMigratingVmsResponse.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    page_size = 42
    page_token = "hello world"
    filter = "hello world"
    order_by = "hello world"

    list_migrating_vms_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :list_migrating_vms, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::ListMigratingVmsRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal 42, request["page_size"]
      assert_equal "hello world", request["page_token"]
      assert_equal "hello world", request["filter"]
      assert_equal "hello world", request["order_by"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, list_migrating_vms_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.list_migrating_vms({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.list_migrating_vms parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.list_migrating_vms ::Google::Cloud::VMMigration::V1::ListMigratingVmsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.list_migrating_vms({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.list_migrating_vms(::Google::Cloud::VMMigration::V1::ListMigratingVmsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, list_migrating_vms_client_stub.call_rpc_count
    end
  end

  def test_get_migrating_vm
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::MigratingVm.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    get_migrating_vm_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :get_migrating_vm, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::GetMigratingVmRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, get_migrating_vm_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.get_migrating_vm({ name: name }) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.get_migrating_vm name: name do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.get_migrating_vm ::Google::Cloud::VMMigration::V1::GetMigratingVmRequest.new(name: name) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.get_migrating_vm({ name: name }, grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.get_migrating_vm(::Google::Cloud::VMMigration::V1::GetMigratingVmRequest.new(name: name), grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, get_migrating_vm_client_stub.call_rpc_count
    end
  end

  def test_update_migrating_vm
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    update_mask = {}
    migrating_vm = {}
    request_id = "hello world"

    update_migrating_vm_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :update_migrating_vm, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::UpdateMigratingVmRequest, request
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::MigratingVm), request["migrating_vm"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, update_migrating_vm_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.update_migrating_vm({ update_mask: update_mask, migrating_vm: migrating_vm, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.update_migrating_vm update_mask: update_mask, migrating_vm: migrating_vm, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.update_migrating_vm ::Google::Cloud::VMMigration::V1::UpdateMigratingVmRequest.new(update_mask: update_mask, migrating_vm: migrating_vm, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.update_migrating_vm({ update_mask: update_mask, migrating_vm: migrating_vm, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.update_migrating_vm(::Google::Cloud::VMMigration::V1::UpdateMigratingVmRequest.new(update_mask: update_mask, migrating_vm: migrating_vm, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, update_migrating_vm_client_stub.call_rpc_count
    end
  end

  def test_delete_migrating_vm
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    delete_migrating_vm_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :delete_migrating_vm, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::DeleteMigratingVmRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, delete_migrating_vm_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.delete_migrating_vm({ name: name }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.delete_migrating_vm name: name do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.delete_migrating_vm ::Google::Cloud::VMMigration::V1::DeleteMigratingVmRequest.new(name: name) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.delete_migrating_vm({ name: name }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.delete_migrating_vm(::Google::Cloud::VMMigration::V1::DeleteMigratingVmRequest.new(name: name), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, delete_migrating_vm_client_stub.call_rpc_count
    end
  end

  def test_start_migration
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    migrating_vm = "hello world"

    start_migration_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :start_migration, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::StartMigrationRequest, request
      assert_equal "hello world", request["migrating_vm"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, start_migration_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.start_migration({ migrating_vm: migrating_vm }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.start_migration migrating_vm: migrating_vm do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.start_migration ::Google::Cloud::VMMigration::V1::StartMigrationRequest.new(migrating_vm: migrating_vm) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.start_migration({ migrating_vm: migrating_vm }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.start_migration(::Google::Cloud::VMMigration::V1::StartMigrationRequest.new(migrating_vm: migrating_vm), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, start_migration_client_stub.call_rpc_count
    end
  end

  def test_resume_migration
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    migrating_vm = "hello world"

    resume_migration_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :resume_migration, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::ResumeMigrationRequest, request
      assert_equal "hello world", request["migrating_vm"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, resume_migration_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.resume_migration({ migrating_vm: migrating_vm }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.resume_migration migrating_vm: migrating_vm do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.resume_migration ::Google::Cloud::VMMigration::V1::ResumeMigrationRequest.new(migrating_vm: migrating_vm) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.resume_migration({ migrating_vm: migrating_vm }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.resume_migration(::Google::Cloud::VMMigration::V1::ResumeMigrationRequest.new(migrating_vm: migrating_vm), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, resume_migration_client_stub.call_rpc_count
    end
  end

  def test_pause_migration
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    migrating_vm = "hello world"

    pause_migration_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :pause_migration, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::PauseMigrationRequest, request
      assert_equal "hello world", request["migrating_vm"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, pause_migration_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.pause_migration({ migrating_vm: migrating_vm }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.pause_migration migrating_vm: migrating_vm do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.pause_migration ::Google::Cloud::VMMigration::V1::PauseMigrationRequest.new(migrating_vm: migrating_vm) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.pause_migration({ migrating_vm: migrating_vm }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.pause_migration(::Google::Cloud::VMMigration::V1::PauseMigrationRequest.new(migrating_vm: migrating_vm), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, pause_migration_client_stub.call_rpc_count
    end
  end

  def test_finalize_migration
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    migrating_vm = "hello world"

    finalize_migration_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :finalize_migration, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::FinalizeMigrationRequest, request
      assert_equal "hello world", request["migrating_vm"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, finalize_migration_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.finalize_migration({ migrating_vm: migrating_vm }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.finalize_migration migrating_vm: migrating_vm do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.finalize_migration ::Google::Cloud::VMMigration::V1::FinalizeMigrationRequest.new(migrating_vm: migrating_vm) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.finalize_migration({ migrating_vm: migrating_vm }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.finalize_migration(::Google::Cloud::VMMigration::V1::FinalizeMigrationRequest.new(migrating_vm: migrating_vm), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, finalize_migration_client_stub.call_rpc_count
    end
  end

  def test_create_clone_job
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    clone_job_id = "hello world"
    clone_job = {}
    request_id = "hello world"

    create_clone_job_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :create_clone_job, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CreateCloneJobRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal "hello world", request["clone_job_id"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::CloneJob), request["clone_job"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, create_clone_job_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.create_clone_job({ parent: parent, clone_job_id: clone_job_id, clone_job: clone_job, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.create_clone_job parent: parent, clone_job_id: clone_job_id, clone_job: clone_job, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.create_clone_job ::Google::Cloud::VMMigration::V1::CreateCloneJobRequest.new(parent: parent, clone_job_id: clone_job_id, clone_job: clone_job, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.create_clone_job({ parent: parent, clone_job_id: clone_job_id, clone_job: clone_job, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.create_clone_job(::Google::Cloud::VMMigration::V1::CreateCloneJobRequest.new(parent: parent, clone_job_id: clone_job_id, clone_job: clone_job, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, create_clone_job_client_stub.call_rpc_count
    end
  end

  def test_cancel_clone_job
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    cancel_clone_job_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :cancel_clone_job, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CancelCloneJobRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, cancel_clone_job_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.cancel_clone_job({ name: name }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.cancel_clone_job name: name do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.cancel_clone_job ::Google::Cloud::VMMigration::V1::CancelCloneJobRequest.new(name: name) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.cancel_clone_job({ name: name }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.cancel_clone_job(::Google::Cloud::VMMigration::V1::CancelCloneJobRequest.new(name: name), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, cancel_clone_job_client_stub.call_rpc_count
    end
  end

  def test_list_clone_jobs
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::ListCloneJobsResponse.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    page_size = 42
    page_token = "hello world"
    filter = "hello world"
    order_by = "hello world"

    list_clone_jobs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :list_clone_jobs, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::ListCloneJobsRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal 42, request["page_size"]
      assert_equal "hello world", request["page_token"]
      assert_equal "hello world", request["filter"]
      assert_equal "hello world", request["order_by"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, list_clone_jobs_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.list_clone_jobs({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.list_clone_jobs parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.list_clone_jobs ::Google::Cloud::VMMigration::V1::ListCloneJobsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.list_clone_jobs({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.list_clone_jobs(::Google::Cloud::VMMigration::V1::ListCloneJobsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, list_clone_jobs_client_stub.call_rpc_count
    end
  end

  def test_get_clone_job
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::CloneJob.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    get_clone_job_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :get_clone_job, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::GetCloneJobRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, get_clone_job_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.get_clone_job({ name: name }) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.get_clone_job name: name do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.get_clone_job ::Google::Cloud::VMMigration::V1::GetCloneJobRequest.new(name: name) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.get_clone_job({ name: name }, grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.get_clone_job(::Google::Cloud::VMMigration::V1::GetCloneJobRequest.new(name: name), grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, get_clone_job_client_stub.call_rpc_count
    end
  end

  def test_create_cutover_job
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    cutover_job_id = "hello world"
    cutover_job = {}
    request_id = "hello world"

    create_cutover_job_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :create_cutover_job, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CreateCutoverJobRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal "hello world", request["cutover_job_id"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::CutoverJob), request["cutover_job"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, create_cutover_job_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.create_cutover_job({ parent: parent, cutover_job_id: cutover_job_id, cutover_job: cutover_job, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.create_cutover_job parent: parent, cutover_job_id: cutover_job_id, cutover_job: cutover_job, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.create_cutover_job ::Google::Cloud::VMMigration::V1::CreateCutoverJobRequest.new(parent: parent, cutover_job_id: cutover_job_id, cutover_job: cutover_job, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.create_cutover_job({ parent: parent, cutover_job_id: cutover_job_id, cutover_job: cutover_job, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.create_cutover_job(::Google::Cloud::VMMigration::V1::CreateCutoverJobRequest.new(parent: parent, cutover_job_id: cutover_job_id, cutover_job: cutover_job, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, create_cutover_job_client_stub.call_rpc_count
    end
  end

  def test_cancel_cutover_job
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    cancel_cutover_job_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :cancel_cutover_job, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CancelCutoverJobRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, cancel_cutover_job_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.cancel_cutover_job({ name: name }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.cancel_cutover_job name: name do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.cancel_cutover_job ::Google::Cloud::VMMigration::V1::CancelCutoverJobRequest.new(name: name) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.cancel_cutover_job({ name: name }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.cancel_cutover_job(::Google::Cloud::VMMigration::V1::CancelCutoverJobRequest.new(name: name), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, cancel_cutover_job_client_stub.call_rpc_count
    end
  end

  def test_list_cutover_jobs
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::ListCutoverJobsResponse.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    page_size = 42
    page_token = "hello world"
    filter = "hello world"
    order_by = "hello world"

    list_cutover_jobs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :list_cutover_jobs, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::ListCutoverJobsRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal 42, request["page_size"]
      assert_equal "hello world", request["page_token"]
      assert_equal "hello world", request["filter"]
      assert_equal "hello world", request["order_by"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, list_cutover_jobs_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.list_cutover_jobs({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.list_cutover_jobs parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.list_cutover_jobs ::Google::Cloud::VMMigration::V1::ListCutoverJobsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.list_cutover_jobs({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.list_cutover_jobs(::Google::Cloud::VMMigration::V1::ListCutoverJobsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, list_cutover_jobs_client_stub.call_rpc_count
    end
  end

  def test_get_cutover_job
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::CutoverJob.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    get_cutover_job_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :get_cutover_job, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::GetCutoverJobRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, get_cutover_job_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.get_cutover_job({ name: name }) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.get_cutover_job name: name do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.get_cutover_job ::Google::Cloud::VMMigration::V1::GetCutoverJobRequest.new(name: name) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.get_cutover_job({ name: name }, grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.get_cutover_job(::Google::Cloud::VMMigration::V1::GetCutoverJobRequest.new(name: name), grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, get_cutover_job_client_stub.call_rpc_count
    end
  end

  def test_list_groups
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::ListGroupsResponse.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    page_size = 42
    page_token = "hello world"
    filter = "hello world"
    order_by = "hello world"

    list_groups_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :list_groups, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::ListGroupsRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal 42, request["page_size"]
      assert_equal "hello world", request["page_token"]
      assert_equal "hello world", request["filter"]
      assert_equal "hello world", request["order_by"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, list_groups_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.list_groups({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.list_groups parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.list_groups ::Google::Cloud::VMMigration::V1::ListGroupsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.list_groups({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.list_groups(::Google::Cloud::VMMigration::V1::ListGroupsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, list_groups_client_stub.call_rpc_count
    end
  end

  def test_get_group
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::Group.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    get_group_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :get_group, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::GetGroupRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, get_group_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.get_group({ name: name }) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.get_group name: name do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.get_group ::Google::Cloud::VMMigration::V1::GetGroupRequest.new(name: name) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.get_group({ name: name }, grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.get_group(::Google::Cloud::VMMigration::V1::GetGroupRequest.new(name: name), grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, get_group_client_stub.call_rpc_count
    end
  end

  def test_create_group
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    group_id = "hello world"
    group = {}
    request_id = "hello world"

    create_group_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :create_group, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CreateGroupRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal "hello world", request["group_id"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::Group), request["group"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, create_group_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.create_group({ parent: parent, group_id: group_id, group: group, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.create_group parent: parent, group_id: group_id, group: group, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.create_group ::Google::Cloud::VMMigration::V1::CreateGroupRequest.new(parent: parent, group_id: group_id, group: group, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.create_group({ parent: parent, group_id: group_id, group: group, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.create_group(::Google::Cloud::VMMigration::V1::CreateGroupRequest.new(parent: parent, group_id: group_id, group: group, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, create_group_client_stub.call_rpc_count
    end
  end

  def test_update_group
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    update_mask = {}
    group = {}
    request_id = "hello world"

    update_group_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :update_group, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::UpdateGroupRequest, request
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::Group), request["group"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, update_group_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.update_group({ update_mask: update_mask, group: group, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.update_group update_mask: update_mask, group: group, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.update_group ::Google::Cloud::VMMigration::V1::UpdateGroupRequest.new(update_mask: update_mask, group: group, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.update_group({ update_mask: update_mask, group: group, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.update_group(::Google::Cloud::VMMigration::V1::UpdateGroupRequest.new(update_mask: update_mask, group: group, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, update_group_client_stub.call_rpc_count
    end
  end

  def test_delete_group
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"
    request_id = "hello world"

    delete_group_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :delete_group, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::DeleteGroupRequest, request
      assert_equal "hello world", request["name"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, delete_group_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.delete_group({ name: name, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.delete_group name: name, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.delete_group ::Google::Cloud::VMMigration::V1::DeleteGroupRequest.new(name: name, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.delete_group({ name: name, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.delete_group(::Google::Cloud::VMMigration::V1::DeleteGroupRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, delete_group_client_stub.call_rpc_count
    end
  end

  def test_add_group_migration
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    group = "hello world"
    migrating_vm = "hello world"

    add_group_migration_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :add_group_migration, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::AddGroupMigrationRequest, request
      assert_equal "hello world", request["group"]
      assert_equal "hello world", request["migrating_vm"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, add_group_migration_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.add_group_migration({ group: group, migrating_vm: migrating_vm }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.add_group_migration group: group, migrating_vm: migrating_vm do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.add_group_migration ::Google::Cloud::VMMigration::V1::AddGroupMigrationRequest.new(group: group, migrating_vm: migrating_vm) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.add_group_migration({ group: group, migrating_vm: migrating_vm }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.add_group_migration(::Google::Cloud::VMMigration::V1::AddGroupMigrationRequest.new(group: group, migrating_vm: migrating_vm), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, add_group_migration_client_stub.call_rpc_count
    end
  end

  def test_remove_group_migration
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    group = "hello world"
    migrating_vm = "hello world"

    remove_group_migration_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :remove_group_migration, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::RemoveGroupMigrationRequest, request
      assert_equal "hello world", request["group"]
      assert_equal "hello world", request["migrating_vm"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, remove_group_migration_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.remove_group_migration({ group: group, migrating_vm: migrating_vm }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.remove_group_migration group: group, migrating_vm: migrating_vm do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.remove_group_migration ::Google::Cloud::VMMigration::V1::RemoveGroupMigrationRequest.new(group: group, migrating_vm: migrating_vm) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.remove_group_migration({ group: group, migrating_vm: migrating_vm }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.remove_group_migration(::Google::Cloud::VMMigration::V1::RemoveGroupMigrationRequest.new(group: group, migrating_vm: migrating_vm), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, remove_group_migration_client_stub.call_rpc_count
    end
  end

  def test_list_target_projects
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::ListTargetProjectsResponse.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    page_size = 42
    page_token = "hello world"
    filter = "hello world"
    order_by = "hello world"

    list_target_projects_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :list_target_projects, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::ListTargetProjectsRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal 42, request["page_size"]
      assert_equal "hello world", request["page_token"]
      assert_equal "hello world", request["filter"]
      assert_equal "hello world", request["order_by"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, list_target_projects_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.list_target_projects({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.list_target_projects parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.list_target_projects ::Google::Cloud::VMMigration::V1::ListTargetProjectsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.list_target_projects({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by }, grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.list_target_projects(::Google::Cloud::VMMigration::V1::ListTargetProjectsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, order_by: order_by), grpc_options) do |response, operation|
        assert_kind_of Gapic::PagedEnumerable, response
        assert_equal grpc_response, response.response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, list_target_projects_client_stub.call_rpc_count
    end
  end

  def test_get_target_project
    # Create GRPC objects.
    grpc_response = ::Google::Cloud::VMMigration::V1::TargetProject.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"

    get_target_project_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :get_target_project, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::GetTargetProjectRequest, request
      assert_equal "hello world", request["name"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, get_target_project_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.get_target_project({ name: name }) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.get_target_project name: name do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.get_target_project ::Google::Cloud::VMMigration::V1::GetTargetProjectRequest.new(name: name) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.get_target_project({ name: name }, grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.get_target_project(::Google::Cloud::VMMigration::V1::GetTargetProjectRequest.new(name: name), grpc_options) do |response, operation|
        assert_equal grpc_response, response
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, get_target_project_client_stub.call_rpc_count
    end
  end

  def test_create_target_project
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    parent = "hello world"
    target_project_id = "hello world"
    target_project = {}
    request_id = "hello world"

    create_target_project_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :create_target_project, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::CreateTargetProjectRequest, request
      assert_equal "hello world", request["parent"]
      assert_equal "hello world", request["target_project_id"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::TargetProject), request["target_project"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, create_target_project_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.create_target_project({ parent: parent, target_project_id: target_project_id, target_project: target_project, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.create_target_project parent: parent, target_project_id: target_project_id, target_project: target_project, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.create_target_project ::Google::Cloud::VMMigration::V1::CreateTargetProjectRequest.new(parent: parent, target_project_id: target_project_id, target_project: target_project, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.create_target_project({ parent: parent, target_project_id: target_project_id, target_project: target_project, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.create_target_project(::Google::Cloud::VMMigration::V1::CreateTargetProjectRequest.new(parent: parent, target_project_id: target_project_id, target_project: target_project, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, create_target_project_client_stub.call_rpc_count
    end
  end

  def test_update_target_project
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    update_mask = {}
    target_project = {}
    request_id = "hello world"

    update_target_project_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :update_target_project, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::UpdateTargetProjectRequest, request
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"]
      assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::VMMigration::V1::TargetProject), request["target_project"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, update_target_project_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.update_target_project({ update_mask: update_mask, target_project: target_project, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.update_target_project update_mask: update_mask, target_project: target_project, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.update_target_project ::Google::Cloud::VMMigration::V1::UpdateTargetProjectRequest.new(update_mask: update_mask, target_project: target_project, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.update_target_project({ update_mask: update_mask, target_project: target_project, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.update_target_project(::Google::Cloud::VMMigration::V1::UpdateTargetProjectRequest.new(update_mask: update_mask, target_project: target_project, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, update_target_project_client_stub.call_rpc_count
    end
  end

  def test_delete_target_project
    # Create GRPC objects.
    grpc_response = ::Google::Longrunning::Operation.new
    grpc_operation = GRPC::ActiveCall::Operation.new nil
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
    grpc_options = {}

    # Create request parameters for a unary method.
    name = "hello world"
    request_id = "hello world"

    delete_target_project_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
      assert_equal :delete_target_project, name
      assert_kind_of ::Google::Cloud::VMMigration::V1::DeleteTargetProjectRequest, request
      assert_equal "hello world", request["name"]
      assert_equal "hello world", request["request_id"]
      refute_nil options
    end

    Gapic::ServiceStub.stub :new, delete_target_project_client_stub do
      # Create client
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end

      # Use hash object
      client.delete_target_project({ name: name, request_id: request_id }) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use named arguments
      client.delete_target_project name: name, request_id: request_id do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object
      client.delete_target_project ::Google::Cloud::VMMigration::V1::DeleteTargetProjectRequest.new(name: name, request_id: request_id) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use hash object with options
      client.delete_target_project({ name: name, request_id: request_id }, grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Use protobuf object with options
      client.delete_target_project(::Google::Cloud::VMMigration::V1::DeleteTargetProjectRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation|
        assert_kind_of Gapic::Operation, response
        assert_equal grpc_response, response.grpc_op
        assert_equal grpc_operation, operation
      end

      # Verify method calls
      assert_equal 5, delete_target_project_client_stub.call_rpc_count
    end
  end

  def test_configure
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure

    client = block_config = config = nil
    Gapic::ServiceStub.stub :new, nil do
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end
    end

    config = client.configure do |c|
      block_config = c
    end

    assert_same block_config, config
    assert_kind_of ::Google::Cloud::VMMigration::V1::VMMigration::Client::Configuration, config
  end

  def test_operations_client
    grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure

    client = nil
    Gapic::ServiceStub.stub :new, nil do
      client = ::Google::Cloud::VMMigration::V1::VMMigration::Client.new do |config|
        config.credentials = grpc_channel
      end
    end

    assert_kind_of ::Google::Cloud::VMMigration::V1::VMMigration::Operations, client.operations_client
  end
end
