AdGroupCriterionLabelServiceClient implements BackgroundResource { public final AdGroupCriterionLabel getAdGroupCriterionLabel( AdGroupCriterionLabelName resourceName) { GetAdGroupCriterionLabelRequest request = GetAdGroupCriterionLabelRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getAdGroupCriterionLabel(request); } protected  AdGroupCriterionLabelServiceClient(AdGroupCriterionLabelServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  AdGroupCriterionLabelServiceClient(AdGroupCriterionLabelServiceStub stub); static final AdGroupCriterionLabelServiceClient create(); static final AdGroupCriterionLabelServiceClient create(
      AdGroupCriterionLabelServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final AdGroupCriterionLabelServiceClient create(
      AdGroupCriterionLabelServiceStub stub); final AdGroupCriterionLabelServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") AdGroupCriterionLabelServiceStub getStub(); final AdGroupCriterionLabel getAdGroupCriterionLabel(
      AdGroupCriterionLabelName resourceName); final AdGroupCriterionLabel getAdGroupCriterionLabel(String resourceName); final AdGroupCriterionLabel getAdGroupCriterionLabel(
      GetAdGroupCriterionLabelRequest request); final UnaryCallable<GetAdGroupCriterionLabelRequest, AdGroupCriterionLabel> getAdGroupCriterionLabelCallable(); final MutateAdGroupCriterionLabelsResponse mutateAdGroupCriterionLabels(
      String customerId, List<AdGroupCriterionLabelOperation> operations); final MutateAdGroupCriterionLabelsResponse mutateAdGroupCriterionLabels(
      MutateAdGroupCriterionLabelsRequest request); final UnaryCallable<
          MutateAdGroupCriterionLabelsRequest, MutateAdGroupCriterionLabelsResponse> mutateAdGroupCriterionLabelsCallable(); @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 getAdGroupCriterionLabelTest() { com.google.ads.googleads.v5.services.AdGroupCriterionLabelName resourceName2 = com.google.ads.googleads.v5.services.AdGroupCriterionLabelName.of( "[CUSTOMER]", "[AD_GROUP_CRITERION_LABEL]"); AdGroupCriterionLabel expectedResponse = AdGroupCriterionLabel.newBuilder().setResourceName(resourceName2.toString()).build(); mockAdGroupCriterionLabelService.addResponse(expectedResponse); AdGroupCriterionLabelName resourceName = AdGroupCriterionLabelName.of("[CUSTOMER]", "[AD_GROUP_CRITERION_LABEL]"); AdGroupCriterionLabel actualResponse = client.getAdGroupCriterionLabel(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdGroupCriterionLabelService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetAdGroupCriterionLabelRequest actualRequest = (GetAdGroupCriterionLabelRequest) actualRequests.get(0); Assert.assertEquals( resourceName, AdGroupCriterionLabelName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getAdGroupCriterionLabelExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockAdGroupCriterionLabelService.addException(exception); try { AdGroupCriterionLabelName resourceName = AdGroupCriterionLabelName.of("[CUSTOMER]", "[AD_GROUP_CRITERION_LABEL]"); client.getAdGroupCriterionLabel(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }