CurrencyConstantServiceClient implements BackgroundResource { public final CurrencyConstant getCurrencyConstant(CurrencyConstantName resourceName) { GetCurrencyConstantRequest request = GetCurrencyConstantRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getCurrencyConstant(request); } protected  CurrencyConstantServiceClient(CurrencyConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CurrencyConstantServiceClient(CurrencyConstantServiceStub stub); static final CurrencyConstantServiceClient create(); static final CurrencyConstantServiceClient create(CurrencyConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CurrencyConstantServiceClient create(CurrencyConstantServiceStub stub); final CurrencyConstantServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CurrencyConstantServiceStub getStub(); final CurrencyConstant getCurrencyConstant(CurrencyConstantName resourceName); final CurrencyConstant getCurrencyConstant(String resourceName); final CurrencyConstant getCurrencyConstant(GetCurrencyConstantRequest request); final UnaryCallable<GetCurrencyConstantRequest, CurrencyConstant> getCurrencyConstantCallable(); @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 getCurrencyConstantTest() { com.google.ads.googleads.v5.services.CurrencyConstantName resourceName2 = com.google.ads.googleads.v5.services.CurrencyConstantName.of("[CURRENCY_CONSTANT]"); String code = "code3059181"; com.google.ads.googleads.v5.services.CurrencyConstantName name = com.google.ads.googleads.v5.services.CurrencyConstantName.of("[CURRENCY_CONSTANT]"); String symbol = "symbol-887523944"; long billableUnitMicros = 1611838444L; CurrencyConstant expectedResponse = CurrencyConstant.newBuilder() .setResourceName(resourceName2.toString()) .setCode(code) .setName(name.toString()) .setSymbol(symbol) .setBillableUnitMicros(billableUnitMicros) .build(); mockCurrencyConstantService.addResponse(expectedResponse); CurrencyConstantName resourceName = CurrencyConstantName.of("[CURRENCY_CONSTANT]"); CurrencyConstant actualResponse = client.getCurrencyConstant(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCurrencyConstantService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCurrencyConstantRequest actualRequest = (GetCurrencyConstantRequest) actualRequests.get(0); Assert.assertEquals(resourceName, CurrencyConstantName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getCurrencyConstantExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCurrencyConstantService.addException(exception); try { CurrencyConstantName resourceName = CurrencyConstantName.of("[CURRENCY_CONSTANT]"); client.getCurrencyConstant(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }