PagedCallable extends UnaryCallable<RequestT, PagedListResponseT> { @Override public ApiFuture<PagedListResponseT> futureCall(RequestT request, ApiCallContext context) { ApiFuture<ResponseT> futureResponse = callable.futureCall(request, context); return pagedListResponseFactory.getFuturePagedResponse( callable.withDefaultCallContext(context), request, context, futureResponse); } PagedCallable(
      UnaryCallable<RequestT, ResponseT> callable,
      PagedListResponseFactory<RequestT, ResponseT, PagedListResponseT> pagedListResponseFactory); @Override String toString(); @Override ApiFuture<PagedListResponseT> futureCall(RequestT request, ApiCallContext context);  }
@Test public void futureCall() { List<List<Integer>> results = Arrays.asList( Arrays.asList(0, 1, 2), Arrays.asList(3, 4), Collections.<Integer>emptyList()); PagedStashCallable callable = new PagedStashCallable(results); PagedCallable<Integer, List<Integer>, ListIntegersPagedResponse> pagedCallable = new PagedCallable<>(callable, new ListIntegersPagedResponseFactory()); Truth.assertThat( ImmutableList.copyOf( pagedCallable.call(0, FakeCallContext.createDefault()).iterateAll())) .containsExactly(0, 1, 2, 3, 4) .inOrder(); }