CustomerClientServiceClient implements BackgroundResource { public final CustomerClient getCustomerClient(CustomerClientName resourceName) { GetCustomerClientRequest request = GetCustomerClientRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getCustomerClient(request); } protected  CustomerClientServiceClient(CustomerClientServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CustomerClientServiceClient(CustomerClientServiceStub stub); static final CustomerClientServiceClient create(); static final CustomerClientServiceClient create(CustomerClientServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CustomerClientServiceClient create(CustomerClientServiceStub stub); final CustomerClientServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CustomerClientServiceStub getStub(); final CustomerClient getCustomerClient(CustomerClientName resourceName); final CustomerClient getCustomerClient(String resourceName); final CustomerClient getCustomerClient(GetCustomerClientRequest request); final UnaryCallable<GetCustomerClientRequest, CustomerClient> getCustomerClientCallable(); @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 getCustomerClientExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCustomerClientService.addException(exception); try { CustomerClientName resourceName = CustomerClientName.of("[CUSTOMER]", "[CUSTOMER_CLIENT]"); client.getCustomerClient(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }
@Test @SuppressWarnings("all") public void getCustomerClientTest() { com.google.ads.googleads.v5.services.CustomerClientName resourceName2 = com.google.ads.googleads.v5.services.CustomerClientName.of( "[CUSTOMER]", "[CUSTOMER_CLIENT]"); CustomerClient expectedResponse = CustomerClient.newBuilder().setResourceName(resourceName2.toString()).build(); mockCustomerClientService.addResponse(expectedResponse); CustomerClientName resourceName = CustomerClientName.of("[CUSTOMER]", "[CUSTOMER_CLIENT]"); CustomerClient actualResponse = client.getCustomerClient(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCustomerClientService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCustomerClientRequest actualRequest = (GetCustomerClientRequest) actualRequests.get(0); Assert.assertEquals(resourceName, CustomerClientName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }