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