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