@Test
public void successMigrateMultiPageResult() throws Throwable {

    // create object in host
    List<ExampleServiceState> states = createExampleDocuments(this.exampleSourceFactory, getSourceHost(),
            this.serviceCount);
    // start migration
    MigrationTaskService.State migrationState = validMigrationState(
            ExampleService.FACTORY_LINK);
    QuerySpecification spec = new QuerySpecification();
    spec.resultLimit = (int) (this.serviceCount / 10);
    migrationState.querySpec = spec;
    TestContext ctx = testCreate(1);
    String[] out = new String[1];
    Operation op = Operation.createPost(this.destinationFactoryUri)
            .setBody(migrationState)
            .setCompletion((o, e) -> {
                if (e != null) {
                    this.host.log("Post service error: %s", Utils.toString(e));
                    ctx.failIteration(e);
                    return;
                }
                out[0] = o.getBody(State.class).documentSelfLink;
                ctx.completeIteration();
            });
    getDestinationHost().send(op);
    testWait(ctx);
    State waitForServiceCompletion = waitForServiceCompletion(out[0], getDestinationHost());
    ServiceStats stats = getStats(out[0], getDestinationHost());
    Long processedDocuments = Long.valueOf((long) stats.entries.get(MigrationTaskService.STAT_NAME_PROCESSED_DOCUMENTS).latestValue);
    assertEquals(TaskStage.FINISHED, waitForServiceCompletion.taskInfo.stage);
    assertEquals(Long.valueOf(this.serviceCount), processedDocuments);
    // check if object is in new host
    List<URI> uris = getFullUri(getDestinationHost(), states);
    getDestinationHost().getServiceState(EnumSet.noneOf(TestProperty.class),
            ExampleServiceState.class, uris);
}