SharedCriterionServiceClient implements BackgroundResource { public final MutateSharedCriteriaResponse mutateSharedCriteria( String customerId, List<SharedCriterionOperation> operations) { MutateSharedCriteriaRequest request = MutateSharedCriteriaRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateSharedCriteria(request); } protected  SharedCriterionServiceClient(SharedCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  SharedCriterionServiceClient(SharedCriterionServiceStub stub); static final SharedCriterionServiceClient create(); static final SharedCriterionServiceClient create(SharedCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final SharedCriterionServiceClient create(SharedCriterionServiceStub stub); final SharedCriterionServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") SharedCriterionServiceStub getStub(); final SharedCriterion getSharedCriterion(SharedCriterionName resourceName); final SharedCriterion getSharedCriterion(String resourceName); final SharedCriterion getSharedCriterion(GetSharedCriterionRequest request); final UnaryCallable<GetSharedCriterionRequest, SharedCriterion> getSharedCriterionCallable(); final MutateSharedCriteriaResponse mutateSharedCriteria(
      String customerId, List<SharedCriterionOperation> operations); final MutateSharedCriteriaResponse mutateSharedCriteria(
      MutateSharedCriteriaRequest request); final UnaryCallable<MutateSharedCriteriaRequest, MutateSharedCriteriaResponse> mutateSharedCriteriaCallable(); @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 mutateSharedCriteriaTest() { MutateSharedCriteriaResponse expectedResponse = MutateSharedCriteriaResponse.newBuilder().build(); mockSharedCriterionService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<SharedCriterionOperation> operations = new ArrayList<>(); MutateSharedCriteriaResponse actualResponse = client.mutateSharedCriteria(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockSharedCriterionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateSharedCriteriaRequest actualRequest = (MutateSharedCriteriaRequest) 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 mutateSharedCriteriaExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockSharedCriterionService.addException(exception); try { String customerId = "customerId-1772061412"; List<SharedCriterionOperation> operations = new ArrayList<>(); client.mutateSharedCriteria(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }