CustomerLabelServiceClient implements BackgroundResource { public final CustomerLabel getCustomerLabel(CustomerLabelName resourceName) { GetCustomerLabelRequest request = GetCustomerLabelRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getCustomerLabel(request); } protected  CustomerLabelServiceClient(CustomerLabelServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CustomerLabelServiceClient(CustomerLabelServiceStub stub); static final CustomerLabelServiceClient create(); static final CustomerLabelServiceClient create(CustomerLabelServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CustomerLabelServiceClient create(CustomerLabelServiceStub stub); final CustomerLabelServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CustomerLabelServiceStub getStub(); final CustomerLabel getCustomerLabel(CustomerLabelName resourceName); final CustomerLabel getCustomerLabel(String resourceName); final CustomerLabel getCustomerLabel(GetCustomerLabelRequest request); final UnaryCallable<GetCustomerLabelRequest, CustomerLabel> getCustomerLabelCallable(); final MutateCustomerLabelsResponse mutateCustomerLabels(
      String customerId, List<CustomerLabelOperation> operations); final MutateCustomerLabelsResponse mutateCustomerLabels(
      MutateCustomerLabelsRequest request); final UnaryCallable<MutateCustomerLabelsRequest, MutateCustomerLabelsResponse> mutateCustomerLabelsCallable(); @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 getCustomerLabelTest() { com.google.ads.googleads.v5.services.CustomerLabelName resourceName2 = com.google.ads.googleads.v5.services.CustomerLabelName.of( "[CUSTOMER]", "[CUSTOMER_LABEL]"); CustomerLabel expectedResponse = CustomerLabel.newBuilder().setResourceName(resourceName2.toString()).build(); mockCustomerLabelService.addResponse(expectedResponse); CustomerLabelName resourceName = CustomerLabelName.of("[CUSTOMER]", "[CUSTOMER_LABEL]"); CustomerLabel actualResponse = client.getCustomerLabel(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCustomerLabelService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCustomerLabelRequest actualRequest = (GetCustomerLabelRequest) actualRequests.get(0); Assert.assertEquals(resourceName, CustomerLabelName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getCustomerLabelExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCustomerLabelService.addException(exception); try { CustomerLabelName resourceName = CustomerLabelName.of("[CUSTOMER]", "[CUSTOMER_LABEL]"); client.getCustomerLabel(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }