CarrierConstantServiceClient implements BackgroundResource { public final CarrierConstant getCarrierConstant(CarrierConstantName resourceName) { GetCarrierConstantRequest request = GetCarrierConstantRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getCarrierConstant(request); } protected  CarrierConstantServiceClient(CarrierConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CarrierConstantServiceClient(CarrierConstantServiceStub stub); static final CarrierConstantServiceClient create(); static final CarrierConstantServiceClient create(CarrierConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CarrierConstantServiceClient create(CarrierConstantServiceStub stub); final CarrierConstantServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CarrierConstantServiceStub getStub(); final CarrierConstant getCarrierConstant(CarrierConstantName resourceName); final CarrierConstant getCarrierConstant(String resourceName); final CarrierConstant getCarrierConstant(GetCarrierConstantRequest request); final UnaryCallable<GetCarrierConstantRequest, CarrierConstant> getCarrierConstantCallable(); @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 getCarrierConstantTest() { com.google.ads.googleads.v5.services.CarrierConstantName resourceName2 = com.google.ads.googleads.v5.services.CarrierConstantName.of("[CARRIER_CONSTANT]"); long id = 3355L; com.google.ads.googleads.v5.services.CarrierConstantName name = com.google.ads.googleads.v5.services.CarrierConstantName.of("[CARRIER_CONSTANT]"); String countryCode = "countryCode1481071862"; CarrierConstant expectedResponse = CarrierConstant.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .setName(name.toString()) .setCountryCode(countryCode) .build(); mockCarrierConstantService.addResponse(expectedResponse); CarrierConstantName resourceName = CarrierConstantName.of("[CARRIER_CONSTANT]"); CarrierConstant actualResponse = client.getCarrierConstant(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCarrierConstantService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCarrierConstantRequest actualRequest = (GetCarrierConstantRequest) actualRequests.get(0); Assert.assertEquals(resourceName, CarrierConstantName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getCarrierConstantExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCarrierConstantService.addException(exception); try { CarrierConstantName resourceName = CarrierConstantName.of("[CARRIER_CONSTANT]"); client.getCarrierConstant(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }