FeedServiceClient implements BackgroundResource { public final MutateFeedsResponse mutateFeeds(String customerId, List<FeedOperation> operations) { MutateFeedsRequest request = MutateFeedsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateFeeds(request); } protected  FeedServiceClient(FeedServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  FeedServiceClient(FeedServiceStub stub); static final FeedServiceClient create(); static final FeedServiceClient create(FeedServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final FeedServiceClient create(FeedServiceStub stub); final FeedServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") FeedServiceStub getStub(); final Feed getFeed(FeedName resourceName); final Feed getFeed(String resourceName); final Feed getFeed(GetFeedRequest request); final UnaryCallable<GetFeedRequest, Feed> getFeedCallable(); final MutateFeedsResponse mutateFeeds(String customerId, List<FeedOperation> operations); final MutateFeedsResponse mutateFeeds(MutateFeedsRequest request); final UnaryCallable<MutateFeedsRequest, MutateFeedsResponse> mutateFeedsCallable(); @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 mutateFeedsTest() { MutateFeedsResponse expectedResponse = MutateFeedsResponse.newBuilder().build(); mockFeedService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<FeedOperation> operations = new ArrayList<>(); MutateFeedsResponse actualResponse = client.mutateFeeds(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockFeedService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateFeedsRequest actualRequest = (MutateFeedsRequest) 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 mutateFeedsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockFeedService.addException(exception); try { String customerId = "customerId-1772061412"; List<FeedOperation> operations = new ArrayList<>(); client.mutateFeeds(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }