FeedServiceClient implements BackgroundResource { public final Feed getFeed(FeedName resourceName) { GetFeedRequest request = GetFeedRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getFeed(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 getFeedTest() { com.google.ads.googleads.v5.services.FeedName resourceName2 = com.google.ads.googleads.v5.services.FeedName.of("[CUSTOMER]", "[FEED]"); Feed expectedResponse = Feed.newBuilder().setResourceName(resourceName2.toString()).build(); mockFeedService.addResponse(expectedResponse); FeedName resourceName = FeedName.of("[CUSTOMER]", "[FEED]"); Feed actualResponse = client.getFeed(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockFeedService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetFeedRequest actualRequest = (GetFeedRequest) actualRequests.get(0); Assert.assertEquals(resourceName, FeedName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getFeedExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockFeedService.addException(exception); try { FeedName resourceName = FeedName.of("[CUSTOMER]", "[FEED]"); client.getFeed(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }