CampaignBudgetServiceClient implements BackgroundResource { public final MutateCampaignBudgetsResponse mutateCampaignBudgets( String customerId, List<CampaignBudgetOperation> operations) { MutateCampaignBudgetsRequest request = MutateCampaignBudgetsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateCampaignBudgets(request); } protected  CampaignBudgetServiceClient(CampaignBudgetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CampaignBudgetServiceClient(CampaignBudgetServiceStub stub); static final CampaignBudgetServiceClient create(); static final CampaignBudgetServiceClient create(CampaignBudgetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CampaignBudgetServiceClient create(CampaignBudgetServiceStub stub); final CampaignBudgetServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CampaignBudgetServiceStub getStub(); final CampaignBudget getCampaignBudget(CampaignBudgetName resourceName); final CampaignBudget getCampaignBudget(String resourceName); final CampaignBudget getCampaignBudget(GetCampaignBudgetRequest request); final UnaryCallable<GetCampaignBudgetRequest, CampaignBudget> getCampaignBudgetCallable(); final MutateCampaignBudgetsResponse mutateCampaignBudgets(
      String customerId, List<CampaignBudgetOperation> operations); final MutateCampaignBudgetsResponse mutateCampaignBudgets(
      MutateCampaignBudgetsRequest request); final UnaryCallable<MutateCampaignBudgetsRequest, MutateCampaignBudgetsResponse> mutateCampaignBudgetsCallable(); @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 mutateCampaignBudgetsTest() { MutateCampaignBudgetsResponse expectedResponse = MutateCampaignBudgetsResponse.newBuilder().build(); mockCampaignBudgetService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<CampaignBudgetOperation> operations = new ArrayList<>(); MutateCampaignBudgetsResponse actualResponse = client.mutateCampaignBudgets(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignBudgetService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateCampaignBudgetsRequest actualRequest = (MutateCampaignBudgetsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void mutateCampaignBudgetsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCampaignBudgetService.addException(exception); try { String customerId = "customerId-1772061412"; List<CampaignBudgetOperation> operations = new ArrayList<>(); client.mutateCampaignBudgets(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }