CampaignLabelServiceClient implements BackgroundResource { public final CampaignLabel getCampaignLabel(CampaignLabelName resourceName) { GetCampaignLabelRequest request = GetCampaignLabelRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getCampaignLabel(request); } protected  CampaignLabelServiceClient(CampaignLabelServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CampaignLabelServiceClient(CampaignLabelServiceStub stub); static final CampaignLabelServiceClient create(); static final CampaignLabelServiceClient create(CampaignLabelServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CampaignLabelServiceClient create(CampaignLabelServiceStub stub); final CampaignLabelServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CampaignLabelServiceStub getStub(); final CampaignLabel getCampaignLabel(CampaignLabelName resourceName); final CampaignLabel getCampaignLabel(String resourceName); final CampaignLabel getCampaignLabel(GetCampaignLabelRequest request); final UnaryCallable<GetCampaignLabelRequest, CampaignLabel> getCampaignLabelCallable(); final MutateCampaignLabelsResponse mutateCampaignLabels(
      String customerId, List<CampaignLabelOperation> operations); final MutateCampaignLabelsResponse mutateCampaignLabels(
      MutateCampaignLabelsRequest request); final UnaryCallable<MutateCampaignLabelsRequest, MutateCampaignLabelsResponse> mutateCampaignLabelsCallable(); @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 getCampaignLabelTest() { com.google.ads.googleads.v5.services.CampaignLabelName resourceName2 = com.google.ads.googleads.v5.services.CampaignLabelName.of( "[CUSTOMER]", "[CAMPAIGN_LABEL]"); CampaignLabel expectedResponse = CampaignLabel.newBuilder().setResourceName(resourceName2.toString()).build(); mockCampaignLabelService.addResponse(expectedResponse); CampaignLabelName resourceName = CampaignLabelName.of("[CUSTOMER]", "[CAMPAIGN_LABEL]"); CampaignLabel actualResponse = client.getCampaignLabel(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignLabelService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCampaignLabelRequest actualRequest = (GetCampaignLabelRequest) actualRequests.get(0); Assert.assertEquals(resourceName, CampaignLabelName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getCampaignLabelExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCampaignLabelService.addException(exception); try { CampaignLabelName resourceName = CampaignLabelName.of("[CUSTOMER]", "[CAMPAIGN_LABEL]"); client.getCampaignLabel(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }