CampaignSharedSetServiceClient implements BackgroundResource { public final CampaignSharedSet getCampaignSharedSet(CampaignSharedSetName resourceName) { GetCampaignSharedSetRequest request = GetCampaignSharedSetRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getCampaignSharedSet(request); } protected  CampaignSharedSetServiceClient(CampaignSharedSetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CampaignSharedSetServiceClient(CampaignSharedSetServiceStub stub); static final CampaignSharedSetServiceClient create(); static final CampaignSharedSetServiceClient create(
      CampaignSharedSetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CampaignSharedSetServiceClient create(CampaignSharedSetServiceStub stub); final CampaignSharedSetServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CampaignSharedSetServiceStub getStub(); final CampaignSharedSet getCampaignSharedSet(CampaignSharedSetName resourceName); final CampaignSharedSet getCampaignSharedSet(String resourceName); final CampaignSharedSet getCampaignSharedSet(GetCampaignSharedSetRequest request); final UnaryCallable<GetCampaignSharedSetRequest, CampaignSharedSet> getCampaignSharedSetCallable(); final MutateCampaignSharedSetsResponse mutateCampaignSharedSets(
      String customerId, List<CampaignSharedSetOperation> operations); final MutateCampaignSharedSetsResponse mutateCampaignSharedSets(
      MutateCampaignSharedSetsRequest request); final UnaryCallable<MutateCampaignSharedSetsRequest, MutateCampaignSharedSetsResponse> mutateCampaignSharedSetsCallable(); @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 getCampaignSharedSetTest() { com.google.ads.googleads.v5.services.CampaignSharedSetName resourceName2 = com.google.ads.googleads.v5.services.CampaignSharedSetName.of( "[CUSTOMER]", "[CAMPAIGN_SHARED_SET]"); CampaignName campaign = CampaignName.of("[CUSTOMER]", "[CAMPAIGN]"); SharedSetName sharedSet = SharedSetName.of("[CUSTOMER]", "[SHARED_SET]"); CampaignSharedSet expectedResponse = CampaignSharedSet.newBuilder() .setResourceName(resourceName2.toString()) .setCampaign(campaign.toString()) .setSharedSet(sharedSet.toString()) .build(); mockCampaignSharedSetService.addResponse(expectedResponse); CampaignSharedSetName resourceName = CampaignSharedSetName.of("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]"); CampaignSharedSet actualResponse = client.getCampaignSharedSet(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignSharedSetService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCampaignSharedSetRequest actualRequest = (GetCampaignSharedSetRequest) actualRequests.get(0); Assert.assertEquals(resourceName, CampaignSharedSetName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getCampaignSharedSetExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCampaignSharedSetService.addException(exception); try { CampaignSharedSetName resourceName = CampaignSharedSetName.of("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]"); client.getCampaignSharedSet(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }