CampaignBidModifierServiceClient implements BackgroundResource { public final CampaignBidModifier getCampaignBidModifier(CampaignBidModifierName resourceName) { GetCampaignBidModifierRequest request = GetCampaignBidModifierRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getCampaignBidModifier(request); } protected  CampaignBidModifierServiceClient(CampaignBidModifierServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CampaignBidModifierServiceClient(CampaignBidModifierServiceStub stub); static final CampaignBidModifierServiceClient create(); static final CampaignBidModifierServiceClient create(
      CampaignBidModifierServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CampaignBidModifierServiceClient create(CampaignBidModifierServiceStub stub); final CampaignBidModifierServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CampaignBidModifierServiceStub getStub(); final CampaignBidModifier getCampaignBidModifier(CampaignBidModifierName resourceName); final CampaignBidModifier getCampaignBidModifier(String resourceName); final CampaignBidModifier getCampaignBidModifier(GetCampaignBidModifierRequest request); final UnaryCallable<GetCampaignBidModifierRequest, CampaignBidModifier> getCampaignBidModifierCallable(); final MutateCampaignBidModifiersResponse mutateCampaignBidModifiers(
      String customerId, List<CampaignBidModifierOperation> operations); final MutateCampaignBidModifiersResponse mutateCampaignBidModifiers(
      MutateCampaignBidModifiersRequest request); final UnaryCallable<MutateCampaignBidModifiersRequest, MutateCampaignBidModifiersResponse> mutateCampaignBidModifiersCallable(); @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 getCampaignBidModifierTest() { com.google.ads.googleads.v5.services.CampaignBidModifierName resourceName2 = com.google.ads.googleads.v5.services.CampaignBidModifierName.of( "[CUSTOMER]", "[CAMPAIGN_BID_MODIFIER]"); CampaignName campaign = CampaignName.of("[CUSTOMER]", "[CAMPAIGN]"); long criterionId = 326773895L; double bidModifier = 1.36236335E8; CampaignBidModifier expectedResponse = CampaignBidModifier.newBuilder() .setResourceName(resourceName2.toString()) .setCampaign(campaign.toString()) .setCriterionId(criterionId) .setBidModifier(bidModifier) .build(); mockCampaignBidModifierService.addResponse(expectedResponse); CampaignBidModifierName resourceName = CampaignBidModifierName.of("[CUSTOMER]", "[CAMPAIGN_BID_MODIFIER]"); CampaignBidModifier actualResponse = client.getCampaignBidModifier(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignBidModifierService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCampaignBidModifierRequest actualRequest = (GetCampaignBidModifierRequest) actualRequests.get(0); Assert.assertEquals( resourceName, CampaignBidModifierName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getCampaignBidModifierExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCampaignBidModifierService.addException(exception); try { CampaignBidModifierName resourceName = CampaignBidModifierName.of("[CUSTOMER]", "[CAMPAIGN_BID_MODIFIER]"); client.getCampaignBidModifier(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }