TaskQuery page2Query = setupPaginatedQuery(tasks, 4, 4);
TaskQuery page3Query = setupPaginatedQuery(tasks, 8, 4);
control.replay();
Response page1Response = assertOkResponse(thrift.getTasksStatus(page1Query));
Response page2Response = assertOkResponse(thrift.getTasksStatus(page2Query));
Response page3Response = assertOkResponse(thrift.getTasksStatus(page3Query));
Iterable<Integer> page1Ids = Lists.newArrayList(Iterables.transform(
page1Response.getResult().getScheduleStatusResult().getTasks(), TO_INSTANCE_ID));
Iterable<Integer> page2Ids = Lists.newArrayList(Iterables.transform(
page2Response.getResult().getScheduleStatusResult().getTasks(), TO_INSTANCE_ID));
Iterable<Integer> page3Ids = Lists.newArrayList(Iterables.transform(
page3Response.getResult().getScheduleStatusResult().getTasks(), TO_INSTANCE_ID));
assertEquals(Lists.newArrayList(0, 1, 2, 3), page1Ids);
assertEquals(Lists.newArrayList(4, 5, 6, 7), page2Ids);
assertEquals(Lists.newArrayList(8, 9), page3Ids);
}