CustomerServiceClient implements BackgroundResource { public final CreateCustomerClientResponse createCustomerClient( String customerId, Customer customerClient) { CreateCustomerClientRequest request = CreateCustomerClientRequest.newBuilder() .setCustomerId(customerId) .setCustomerClient(customerClient) .build(); return createCustomerClient(request); } protected  CustomerServiceClient(CustomerServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CustomerServiceClient(CustomerServiceStub stub); static final CustomerServiceClient create(); static final CustomerServiceClient create(CustomerServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CustomerServiceClient create(CustomerServiceStub stub); final CustomerServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CustomerServiceStub getStub(); final Customer getCustomer(CustomerName resourceName); final Customer getCustomer(String resourceName); final Customer getCustomer(GetCustomerRequest request); final UnaryCallable<GetCustomerRequest, Customer> getCustomerCallable(); final MutateCustomerResponse mutateCustomer(
      String customerId, CustomerOperation operation); final MutateCustomerResponse mutateCustomer(MutateCustomerRequest request); final UnaryCallable<MutateCustomerRequest, MutateCustomerResponse> mutateCustomerCallable(); final ListAccessibleCustomersResponse listAccessibleCustomers(
      ListAccessibleCustomersRequest request); final UnaryCallable<ListAccessibleCustomersRequest, ListAccessibleCustomersResponse> listAccessibleCustomersCallable(); final CreateCustomerClientResponse createCustomerClient(
      String customerId, Customer customerClient); final CreateCustomerClientResponse createCustomerClient(
      CreateCustomerClientRequest request); final UnaryCallable<CreateCustomerClientRequest, CreateCustomerClientResponse> createCustomerClientCallable(); @Override final void close(); @Override void shutdown(); @Override boolean isShutdown(); @Override boolean isTerminated(); @Override void shutdownNow(); @Override boolean awaitTermination(long duration, TimeUnit unit);  }
@Test @SuppressWarnings("all") public void createCustomerClientTest() { String resourceName = "resourceName979421212"; String invitationLink = "invitationLink-2091530016"; CreateCustomerClientResponse expectedResponse = CreateCustomerClientResponse.newBuilder() .setResourceName(resourceName) .setInvitationLink(invitationLink) .build(); mockCustomerService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; Customer customerClient = Customer.newBuilder().build(); CreateCustomerClientResponse actualResponse = client.createCustomerClient(customerId, customerClient); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCustomerService.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateCustomerClientRequest actualRequest = (CreateCustomerClientRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(customerClient, actualRequest.getCustomerClient()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void createCustomerClientExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCustomerService.addException(exception); try { String customerId = "customerId-1772061412"; Customer customerClient = Customer.newBuilder().build(); client.createCustomerClient(customerId, customerClient); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }