FeedItemServiceClient implements BackgroundResource { public final MutateFeedItemsResponse mutateFeedItems( String customerId, List<FeedItemOperation> operations) { MutateFeedItemsRequest request = MutateFeedItemsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateFeedItems(request); } protected  FeedItemServiceClient(FeedItemServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  FeedItemServiceClient(FeedItemServiceStub stub); static final FeedItemServiceClient create(); static final FeedItemServiceClient create(FeedItemServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final FeedItemServiceClient create(FeedItemServiceStub stub); final FeedItemServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") FeedItemServiceStub getStub(); final FeedItem getFeedItem(FeedItemName resourceName); final FeedItem getFeedItem(String resourceName); final FeedItem getFeedItem(GetFeedItemRequest request); final UnaryCallable<GetFeedItemRequest, FeedItem> getFeedItemCallable(); final MutateFeedItemsResponse mutateFeedItems(
      String customerId, List<FeedItemOperation> operations); final MutateFeedItemsResponse mutateFeedItems(MutateFeedItemsRequest request); final UnaryCallable<MutateFeedItemsRequest, MutateFeedItemsResponse> mutateFeedItemsCallable(); @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 mutateFeedItemsTest() { MutateFeedItemsResponse expectedResponse = MutateFeedItemsResponse.newBuilder().build(); mockFeedItemService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<FeedItemOperation> operations = new ArrayList<>(); MutateFeedItemsResponse actualResponse = client.mutateFeedItems(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockFeedItemService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateFeedItemsRequest actualRequest = (MutateFeedItemsRequest) 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 mutateFeedItemsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockFeedItemService.addException(exception); try { String customerId = "customerId-1772061412"; List<FeedItemOperation> operations = new ArrayList<>(); client.mutateFeedItems(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }