AdGroupCriterionServiceClient implements BackgroundResource { public final AdGroupCriterion getAdGroupCriterion(AdGroupCriterionName resourceName) { GetAdGroupCriterionRequest request = GetAdGroupCriterionRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getAdGroupCriterion(request); } protected  AdGroupCriterionServiceClient(AdGroupCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  AdGroupCriterionServiceClient(AdGroupCriterionServiceStub stub); static final AdGroupCriterionServiceClient create(); static final AdGroupCriterionServiceClient create(AdGroupCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final AdGroupCriterionServiceClient create(AdGroupCriterionServiceStub stub); final AdGroupCriterionServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") AdGroupCriterionServiceStub getStub(); final AdGroupCriterion getAdGroupCriterion(AdGroupCriterionName resourceName); final AdGroupCriterion getAdGroupCriterion(String resourceName); final AdGroupCriterion getAdGroupCriterion(GetAdGroupCriterionRequest request); final UnaryCallable<GetAdGroupCriterionRequest, AdGroupCriterion> getAdGroupCriterionCallable(); final MutateAdGroupCriteriaResponse mutateAdGroupCriteria(
      String customerId, List<AdGroupCriterionOperation> operations); final MutateAdGroupCriteriaResponse mutateAdGroupCriteria(
      MutateAdGroupCriteriaRequest request); final UnaryCallable<MutateAdGroupCriteriaRequest, MutateAdGroupCriteriaResponse> mutateAdGroupCriteriaCallable(); @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 getAdGroupCriterionTest() { com.google.ads.googleads.v5.services.AdGroupCriterionName resourceName2 = com.google.ads.googleads.v5.services.AdGroupCriterionName.of( "[CUSTOMER]", "[AD_GROUP_CRITERION]"); long criterionId = 326773895L; AdGroupName adGroup = AdGroupName.of("[CUSTOMER]", "[AD_GROUP]"); boolean negative = false; double bidModifier = 1.36236335E8; long cpcBidMicros = 909381114L; long cpmBidMicros = 2094758992L; long cpvBidMicros = 933014521L; long percentCpcBidMicros = 2098488628L; long effectiveCpcBidMicros = 1373966446L; long effectiveCpmBidMicros = 83139256L; long effectiveCpvBidMicros = 1078605215L; long effectivePercentCpcBidMicros = 584306996L; String finalUrlSuffix = "finalUrlSuffix-1825164662"; String trackingUrlTemplate = "trackingUrlTemplate-1611329070"; AdGroupCriterion expectedResponse = AdGroupCriterion.newBuilder() .setResourceName(resourceName2.toString()) .setCriterionId(criterionId) .setAdGroup(adGroup.toString()) .setNegative(negative) .setBidModifier(bidModifier) .setCpcBidMicros(cpcBidMicros) .setCpmBidMicros(cpmBidMicros) .setCpvBidMicros(cpvBidMicros) .setPercentCpcBidMicros(percentCpcBidMicros) .setEffectiveCpcBidMicros(effectiveCpcBidMicros) .setEffectiveCpmBidMicros(effectiveCpmBidMicros) .setEffectiveCpvBidMicros(effectiveCpvBidMicros) .setEffectivePercentCpcBidMicros(effectivePercentCpcBidMicros) .setFinalUrlSuffix(finalUrlSuffix) .setTrackingUrlTemplate(trackingUrlTemplate) .build(); mockAdGroupCriterionService.addResponse(expectedResponse); AdGroupCriterionName resourceName = AdGroupCriterionName.of("[CUSTOMER]", "[AD_GROUP_CRITERION]"); AdGroupCriterion actualResponse = client.getAdGroupCriterion(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdGroupCriterionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetAdGroupCriterionRequest actualRequest = (GetAdGroupCriterionRequest) actualRequests.get(0); Assert.assertEquals(resourceName, AdGroupCriterionName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getAdGroupCriterionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockAdGroupCriterionService.addException(exception); try { AdGroupCriterionName resourceName = AdGroupCriterionName.of("[CUSTOMER]", "[AD_GROUP_CRITERION]"); client.getAdGroupCriterion(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }