FeedItemTargetServiceClient implements BackgroundResource { public final MutateFeedItemTargetsResponse mutateFeedItemTargets( String customerId, List<FeedItemTargetOperation> operations) { MutateFeedItemTargetsRequest request = MutateFeedItemTargetsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateFeedItemTargets(request); } protected  FeedItemTargetServiceClient(FeedItemTargetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  FeedItemTargetServiceClient(FeedItemTargetServiceStub stub); static final FeedItemTargetServiceClient create(); static final FeedItemTargetServiceClient create(FeedItemTargetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final FeedItemTargetServiceClient create(FeedItemTargetServiceStub stub); final FeedItemTargetServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") FeedItemTargetServiceStub getStub(); final FeedItemTarget getFeedItemTarget(FeedItemTargetName resourceName); final FeedItemTarget getFeedItemTarget(String resourceName); final FeedItemTarget getFeedItemTarget(GetFeedItemTargetRequest request); final UnaryCallable<GetFeedItemTargetRequest, FeedItemTarget> getFeedItemTargetCallable(); final MutateFeedItemTargetsResponse mutateFeedItemTargets(
      String customerId, List<FeedItemTargetOperation> operations); final MutateFeedItemTargetsResponse mutateFeedItemTargets(
      MutateFeedItemTargetsRequest request); final UnaryCallable<MutateFeedItemTargetsRequest, MutateFeedItemTargetsResponse> mutateFeedItemTargetsCallable(); @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 mutateFeedItemTargetsTest() { MutateFeedItemTargetsResponse expectedResponse = MutateFeedItemTargetsResponse.newBuilder().build(); mockFeedItemTargetService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<FeedItemTargetOperation> operations = new ArrayList<>(); MutateFeedItemTargetsResponse actualResponse = client.mutateFeedItemTargets(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockFeedItemTargetService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateFeedItemTargetsRequest actualRequest = (MutateFeedItemTargetsRequest) 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 mutateFeedItemTargetsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockFeedItemTargetService.addException(exception); try { String customerId = "customerId-1772061412"; List<FeedItemTargetOperation> operations = new ArrayList<>(); client.mutateFeedItemTargets(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }