LanguageConstantServiceClient implements BackgroundResource { public final LanguageConstant getLanguageConstant(LanguageConstantName resourceName) { GetLanguageConstantRequest request = GetLanguageConstantRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getLanguageConstant(request); } protected  LanguageConstantServiceClient(LanguageConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  LanguageConstantServiceClient(LanguageConstantServiceStub stub); static final LanguageConstantServiceClient create(); static final LanguageConstantServiceClient create(LanguageConstantServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final LanguageConstantServiceClient create(LanguageConstantServiceStub stub); final LanguageConstantServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") LanguageConstantServiceStub getStub(); final LanguageConstant getLanguageConstant(LanguageConstantName resourceName); final LanguageConstant getLanguageConstant(String resourceName); final LanguageConstant getLanguageConstant(GetLanguageConstantRequest request); final UnaryCallable<GetLanguageConstantRequest, LanguageConstant> getLanguageConstantCallable(); @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 getLanguageConstantTest() { com.google.ads.googleads.v5.services.LanguageConstantName resourceName2 = com.google.ads.googleads.v5.services.LanguageConstantName.of("[LANGUAGE_CONSTANT]"); long id = 3355L; String code = "code3059181"; com.google.ads.googleads.v5.services.LanguageConstantName name = com.google.ads.googleads.v5.services.LanguageConstantName.of("[LANGUAGE_CONSTANT]"); boolean targetable = false; LanguageConstant expectedResponse = LanguageConstant.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .setCode(code) .setName(name.toString()) .setTargetable(targetable) .build(); mockLanguageConstantService.addResponse(expectedResponse); LanguageConstantName resourceName = LanguageConstantName.of("[LANGUAGE_CONSTANT]"); LanguageConstant actualResponse = client.getLanguageConstant(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockLanguageConstantService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetLanguageConstantRequest actualRequest = (GetLanguageConstantRequest) actualRequests.get(0); Assert.assertEquals(resourceName, LanguageConstantName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getLanguageConstantExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockLanguageConstantService.addException(exception); try { LanguageConstantName resourceName = LanguageConstantName.of("[LANGUAGE_CONSTANT]"); client.getLanguageConstant(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }