@Test
public void getAllLoadBalancersWithPagination() {

    final List<JobLoadBalancer> jobLoadBalancersOne = Observable.range(1, 5)
            .map(i -> new JobLoadBalancer(JOB_1, String.format("LB_1_%d", i.intValue())))
            .toList().toBlocking().first();
    final List<JobLoadBalancer> jobLoadBalancersTwo = Observable.range(1, 5)
            .map(i -> new JobLoadBalancer(JOB_2, String.format("LB_2_%d", i.intValue())))
            .toList().toBlocking().first();
    final CellWithLoadBalancers cellWithLoadBalancersOne = new CellWithLoadBalancers(jobLoadBalancersOne);
    final CellWithLoadBalancers cellWithLoadBalancersTwo = new CellWithLoadBalancers(jobLoadBalancersTwo);
    cellOne.getServiceRegistry().addService(cellWithLoadBalancersOne);
    cellTwo.getServiceRegistry().addService(cellWithLoadBalancersTwo);
    final List<JobLoadBalancer> results = ServiceTests.walkAllPages(
            2,
            request -> service.getAllLoadBalancers(request, JUNIT_REST_CALL_METADATA),
            page -> GetAllLoadBalancersRequest.newBuilder().setPage(page).build(),
            GetAllLoadBalancersResult::getPagination,
            this::buildJobLoadBalancerList
    );
    assertThat(results).hasSize(10);
}