GeoTargetConstantServiceClient implements BackgroundResource { public final GeoTargetConstant getGeoTargetConstant(GeoTargetConstantName resourceName) { GetGeoTargetConstantRequest request = GetGeoTargetConstantRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getGeoTargetConstant(request); } protected  GeoTargetConstantServiceClient(GeoTargetConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  GeoTargetConstantServiceClient(GeoTargetConstantServiceStub stub); static final GeoTargetConstantServiceClient create(); static final GeoTargetConstantServiceClient create(
      GeoTargetConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final GeoTargetConstantServiceClient create(GeoTargetConstantServiceStub stub); final GeoTargetConstantServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") GeoTargetConstantServiceStub getStub(); final GeoTargetConstant getGeoTargetConstant(GeoTargetConstantName resourceName); final GeoTargetConstant getGeoTargetConstant(String resourceName); final GeoTargetConstant getGeoTargetConstant(GetGeoTargetConstantRequest request); final UnaryCallable<GetGeoTargetConstantRequest, GeoTargetConstant> getGeoTargetConstantCallable(); final SuggestGeoTargetConstantsResponse suggestGeoTargetConstants(
      SuggestGeoTargetConstantsRequest request); final UnaryCallable<SuggestGeoTargetConstantsRequest, SuggestGeoTargetConstantsResponse> suggestGeoTargetConstantsCallable(); @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 getGeoTargetConstantTest() { com.google.ads.googleads.v5.services.GeoTargetConstantName resourceName2 = com.google.ads.googleads.v5.services.GeoTargetConstantName.of("[GEO_TARGET_CONSTANT]"); long id = 3355L; com.google.ads.googleads.v5.services.GeoTargetConstantName name = com.google.ads.googleads.v5.services.GeoTargetConstantName.of("[GEO_TARGET_CONSTANT]"); String countryCode = "countryCode1481071862"; String targetType = "targetType-2084558552"; String canonicalName = "canonicalName1385400054"; com.google.ads.googleads.v5.services.GeoTargetConstantName parentGeoTarget = com.google.ads.googleads.v5.services.GeoTargetConstantName.of("[GEO_TARGET_CONSTANT]"); GeoTargetConstant expectedResponse = GeoTargetConstant.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .setName(name.toString()) .setCountryCode(countryCode) .setTargetType(targetType) .setCanonicalName(canonicalName) .setParentGeoTarget(parentGeoTarget.toString()) .build(); mockGeoTargetConstantService.addResponse(expectedResponse); GeoTargetConstantName resourceName = GeoTargetConstantName.of("[GEO_TARGET_CONSTANT]"); GeoTargetConstant actualResponse = client.getGeoTargetConstant(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockGeoTargetConstantService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetGeoTargetConstantRequest actualRequest = (GetGeoTargetConstantRequest) actualRequests.get(0); Assert.assertEquals(resourceName, GeoTargetConstantName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getGeoTargetConstantExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockGeoTargetConstantService.addException(exception); try { GeoTargetConstantName resourceName = GeoTargetConstantName.of("[GEO_TARGET_CONSTANT]"); client.getGeoTargetConstant(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }