CampaignServiceClient implements BackgroundResource { public final MutateCampaignsResponse mutateCampaigns( String customerId, List<CampaignOperation> operations) { MutateCampaignsRequest request = MutateCampaignsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateCampaigns(request); } protected  CampaignServiceClient(CampaignServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CampaignServiceClient(CampaignServiceStub stub); static final CampaignServiceClient create(); static final CampaignServiceClient create(CampaignServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CampaignServiceClient create(CampaignServiceStub stub); final CampaignServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CampaignServiceStub getStub(); final Campaign getCampaign(CampaignName resourceName); final Campaign getCampaign(String resourceName); final Campaign getCampaign(GetCampaignRequest request); final UnaryCallable<GetCampaignRequest, Campaign> getCampaignCallable(); final MutateCampaignsResponse mutateCampaigns(
      String customerId, List<CampaignOperation> operations); final MutateCampaignsResponse mutateCampaigns(MutateCampaignsRequest request); final UnaryCallable<MutateCampaignsRequest, MutateCampaignsResponse> mutateCampaignsCallable(); @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 mutateCampaignsTest() { MutateCampaignsResponse expectedResponse = MutateCampaignsResponse.newBuilder().build(); mockCampaignService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<CampaignOperation> operations = new ArrayList<>(); MutateCampaignsResponse actualResponse = client.mutateCampaigns(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateCampaignsRequest actualRequest = (MutateCampaignsRequest) 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 mutateCampaignsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCampaignService.addException(exception); try { String customerId = "customerId-1772061412"; List<CampaignOperation> operations = new ArrayList<>(); client.mutateCampaigns(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }