CampaignDraftServiceClient implements BackgroundResource { public final MutateCampaignDraftsResponse mutateCampaignDrafts( String customerId, List<CampaignDraftOperation> operations) { MutateCampaignDraftsRequest request = MutateCampaignDraftsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateCampaignDrafts(request); } protected  CampaignDraftServiceClient(CampaignDraftServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CampaignDraftServiceClient(CampaignDraftServiceStub stub); static final CampaignDraftServiceClient create(); static final CampaignDraftServiceClient create(CampaignDraftServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CampaignDraftServiceClient create(CampaignDraftServiceStub stub); final CampaignDraftServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CampaignDraftServiceStub getStub(); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationsClient getOperationsClient(); final CampaignDraft getCampaignDraft(CampaignDraftName resourceName); final CampaignDraft getCampaignDraft(String resourceName); final CampaignDraft getCampaignDraft(GetCampaignDraftRequest request); final UnaryCallable<GetCampaignDraftRequest, CampaignDraft> getCampaignDraftCallable(); final MutateCampaignDraftsResponse mutateCampaignDrafts(
      String customerId, List<CampaignDraftOperation> operations); final MutateCampaignDraftsResponse mutateCampaignDrafts(
      MutateCampaignDraftsRequest request); final UnaryCallable<MutateCampaignDraftsRequest, MutateCampaignDraftsResponse> mutateCampaignDraftsCallable(); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationFuture<Empty, Empty> promoteCampaignDraftAsync(String campaignDraft); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationFuture<Empty, Empty> promoteCampaignDraftAsync(
      PromoteCampaignDraftRequest request); @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") final OperationCallable<PromoteCampaignDraftRequest, Empty, Empty> promoteCampaignDraftOperationCallable(); final UnaryCallable<PromoteCampaignDraftRequest, Operation> promoteCampaignDraftCallable(); final ListCampaignDraftAsyncErrorsPagedResponse listCampaignDraftAsyncErrors(
      CampaignDraftName resourceName); final ListCampaignDraftAsyncErrorsPagedResponse listCampaignDraftAsyncErrors(
      String resourceName); final ListCampaignDraftAsyncErrorsPagedResponse listCampaignDraftAsyncErrors(
      ListCampaignDraftAsyncErrorsRequest request); final UnaryCallable<
          ListCampaignDraftAsyncErrorsRequest, ListCampaignDraftAsyncErrorsPagedResponse> listCampaignDraftAsyncErrorsPagedCallable(); final UnaryCallable<
          ListCampaignDraftAsyncErrorsRequest, ListCampaignDraftAsyncErrorsResponse> listCampaignDraftAsyncErrorsCallable(); @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 mutateCampaignDraftsTest() { MutateCampaignDraftsResponse expectedResponse = MutateCampaignDraftsResponse.newBuilder().build(); mockCampaignDraftService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<CampaignDraftOperation> operations = new ArrayList<>(); MutateCampaignDraftsResponse actualResponse = client.mutateCampaignDrafts(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignDraftService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateCampaignDraftsRequest actualRequest = (MutateCampaignDraftsRequest) 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 mutateCampaignDraftsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCampaignDraftService.addException(exception); try { String customerId = "customerId-1772061412"; List<CampaignDraftOperation> operations = new ArrayList<>(); client.mutateCampaignDrafts(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }