CampaignExtensionSettingServiceClient implements BackgroundResource { public final CampaignExtensionSetting getCampaignExtensionSetting( CampaignExtensionSettingName resourceName) { GetCampaignExtensionSettingRequest request = GetCampaignExtensionSettingRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getCampaignExtensionSetting(request); } protected  CampaignExtensionSettingServiceClient(CampaignExtensionSettingServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CampaignExtensionSettingServiceClient(CampaignExtensionSettingServiceStub stub); static final CampaignExtensionSettingServiceClient create(); static final CampaignExtensionSettingServiceClient create(
      CampaignExtensionSettingServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CampaignExtensionSettingServiceClient create(
      CampaignExtensionSettingServiceStub stub); final CampaignExtensionSettingServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CampaignExtensionSettingServiceStub getStub(); final CampaignExtensionSetting getCampaignExtensionSetting(
      CampaignExtensionSettingName resourceName); final CampaignExtensionSetting getCampaignExtensionSetting(String resourceName); final CampaignExtensionSetting getCampaignExtensionSetting(
      GetCampaignExtensionSettingRequest request); final UnaryCallable<GetCampaignExtensionSettingRequest, CampaignExtensionSetting> getCampaignExtensionSettingCallable(); final MutateCampaignExtensionSettingsResponse mutateCampaignExtensionSettings(
      String customerId, List<CampaignExtensionSettingOperation> operations); final MutateCampaignExtensionSettingsResponse mutateCampaignExtensionSettings(
      MutateCampaignExtensionSettingsRequest request); final UnaryCallable<
          MutateCampaignExtensionSettingsRequest, MutateCampaignExtensionSettingsResponse> mutateCampaignExtensionSettingsCallable(); @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 getCampaignExtensionSettingTest() { com.google.ads.googleads.v5.services.CampaignExtensionSettingName resourceName2 = com.google.ads.googleads.v5.services.CampaignExtensionSettingName.of( "[CUSTOMER]", "[CAMPAIGN_EXTENSION_SETTING]"); CampaignExtensionSetting expectedResponse = CampaignExtensionSetting.newBuilder().setResourceName(resourceName2.toString()).build(); mockCampaignExtensionSettingService.addResponse(expectedResponse); CampaignExtensionSettingName resourceName = CampaignExtensionSettingName.of("[CUSTOMER]", "[CAMPAIGN_EXTENSION_SETTING]"); CampaignExtensionSetting actualResponse = client.getCampaignExtensionSetting(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignExtensionSettingService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCampaignExtensionSettingRequest actualRequest = (GetCampaignExtensionSettingRequest) actualRequests.get(0); Assert.assertEquals( resourceName, CampaignExtensionSettingName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getCampaignExtensionSettingExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCampaignExtensionSettingService.addException(exception); try { CampaignExtensionSettingName resourceName = CampaignExtensionSettingName.of("[CUSTOMER]", "[CAMPAIGN_EXTENSION_SETTING]"); client.getCampaignExtensionSetting(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }