AgeRangeViewServiceClient implements BackgroundResource { public final AgeRangeView getAgeRangeView(AgeRangeViewName resourceName) { GetAgeRangeViewRequest request = GetAgeRangeViewRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getAgeRangeView(request); } protected  AgeRangeViewServiceClient(AgeRangeViewServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  AgeRangeViewServiceClient(AgeRangeViewServiceStub stub); static final AgeRangeViewServiceClient create(); static final AgeRangeViewServiceClient create(AgeRangeViewServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final AgeRangeViewServiceClient create(AgeRangeViewServiceStub stub); final AgeRangeViewServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") AgeRangeViewServiceStub getStub(); final AgeRangeView getAgeRangeView(AgeRangeViewName resourceName); final AgeRangeView getAgeRangeView(String resourceName); final AgeRangeView getAgeRangeView(GetAgeRangeViewRequest request); final UnaryCallable<GetAgeRangeViewRequest, AgeRangeView> getAgeRangeViewCallable(); @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 getAgeRangeViewTest() { com.google.ads.googleads.v5.services.AgeRangeViewName resourceName2 = com.google.ads.googleads.v5.services.AgeRangeViewName.of("[CUSTOMER]", "[AGE_RANGE_VIEW]"); AgeRangeView expectedResponse = AgeRangeView.newBuilder().setResourceName(resourceName2.toString()).build(); mockAgeRangeViewService.addResponse(expectedResponse); AgeRangeViewName resourceName = AgeRangeViewName.of("[CUSTOMER]", "[AGE_RANGE_VIEW]"); AgeRangeView actualResponse = client.getAgeRangeView(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAgeRangeViewService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetAgeRangeViewRequest actualRequest = (GetAgeRangeViewRequest) actualRequests.get(0); Assert.assertEquals(resourceName, AgeRangeViewName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getAgeRangeViewExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockAgeRangeViewService.addException(exception); try { AgeRangeViewName resourceName = AgeRangeViewName.of("[CUSTOMER]", "[AGE_RANGE_VIEW]"); client.getAgeRangeView(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }