KeywordPlanCampaignServiceClient implements BackgroundResource { public final KeywordPlanCampaign getKeywordPlanCampaign(KeywordPlanCampaignName resourceName) { GetKeywordPlanCampaignRequest request = GetKeywordPlanCampaignRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getKeywordPlanCampaign(request); } protected  KeywordPlanCampaignServiceClient(KeywordPlanCampaignServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  KeywordPlanCampaignServiceClient(KeywordPlanCampaignServiceStub stub); static final KeywordPlanCampaignServiceClient create(); static final KeywordPlanCampaignServiceClient create(
      KeywordPlanCampaignServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final KeywordPlanCampaignServiceClient create(KeywordPlanCampaignServiceStub stub); final KeywordPlanCampaignServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") KeywordPlanCampaignServiceStub getStub(); final KeywordPlanCampaign getKeywordPlanCampaign(KeywordPlanCampaignName resourceName); final KeywordPlanCampaign getKeywordPlanCampaign(String resourceName); final KeywordPlanCampaign getKeywordPlanCampaign(GetKeywordPlanCampaignRequest request); final UnaryCallable<GetKeywordPlanCampaignRequest, KeywordPlanCampaign> getKeywordPlanCampaignCallable(); final MutateKeywordPlanCampaignsResponse mutateKeywordPlanCampaigns(
      String customerId, List<KeywordPlanCampaignOperation> operations); final MutateKeywordPlanCampaignsResponse mutateKeywordPlanCampaigns(
      MutateKeywordPlanCampaignsRequest request); final UnaryCallable<MutateKeywordPlanCampaignsRequest, MutateKeywordPlanCampaignsResponse> mutateKeywordPlanCampaignsCallable(); @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 getKeywordPlanCampaignTest() { com.google.ads.googleads.v5.services.KeywordPlanCampaignName resourceName2 = com.google.ads.googleads.v5.services.KeywordPlanCampaignName.of( "[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"); KeywordPlanCampaign expectedResponse = KeywordPlanCampaign.newBuilder().setResourceName(resourceName2.toString()).build(); mockKeywordPlanCampaignService.addResponse(expectedResponse); KeywordPlanCampaignName resourceName = KeywordPlanCampaignName.of("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"); KeywordPlanCampaign actualResponse = client.getKeywordPlanCampaign(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockKeywordPlanCampaignService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetKeywordPlanCampaignRequest actualRequest = (GetKeywordPlanCampaignRequest) actualRequests.get(0); Assert.assertEquals( resourceName, KeywordPlanCampaignName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getKeywordPlanCampaignExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockKeywordPlanCampaignService.addException(exception); try { KeywordPlanCampaignName resourceName = KeywordPlanCampaignName.of("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"); client.getKeywordPlanCampaign(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }