CampaignCriterionServiceClient implements BackgroundResource { public final MutateCampaignCriteriaResponse mutateCampaignCriteria( String customerId, List<CampaignCriterionOperation> operations) { MutateCampaignCriteriaRequest request = MutateCampaignCriteriaRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateCampaignCriteria(request); } protected  CampaignCriterionServiceClient(CampaignCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CampaignCriterionServiceClient(CampaignCriterionServiceStub stub); static final CampaignCriterionServiceClient create(); static final CampaignCriterionServiceClient create(
      CampaignCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CampaignCriterionServiceClient create(CampaignCriterionServiceStub stub); final CampaignCriterionServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CampaignCriterionServiceStub getStub(); final CampaignCriterion getCampaignCriterion(CampaignCriterionName resourceName); final CampaignCriterion getCampaignCriterion(String resourceName); final CampaignCriterion getCampaignCriterion(GetCampaignCriterionRequest request); final UnaryCallable<GetCampaignCriterionRequest, CampaignCriterion> getCampaignCriterionCallable(); final MutateCampaignCriteriaResponse mutateCampaignCriteria(
      String customerId, List<CampaignCriterionOperation> operations); final MutateCampaignCriteriaResponse mutateCampaignCriteria(
      MutateCampaignCriteriaRequest request); final UnaryCallable<MutateCampaignCriteriaRequest, MutateCampaignCriteriaResponse> mutateCampaignCriteriaCallable(); @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 mutateCampaignCriteriaTest() { MutateCampaignCriteriaResponse expectedResponse = MutateCampaignCriteriaResponse.newBuilder().build(); mockCampaignCriterionService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<CampaignCriterionOperation> operations = new ArrayList<>(); MutateCampaignCriteriaResponse actualResponse = client.mutateCampaignCriteria(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCampaignCriterionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateCampaignCriteriaRequest actualRequest = (MutateCampaignCriteriaRequest) 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 mutateCampaignCriteriaExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCampaignCriterionService.addException(exception); try { String customerId = "customerId-1772061412"; List<CampaignCriterionOperation> operations = new ArrayList<>(); client.mutateCampaignCriteria(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }