@Test
public void successMigrateWithCalculateEstimateOption() throws Throwable {

    createExampleDocuments(this.exampleSourceFactory, getSourceHost(), this.serviceCount);
    // start migration with calculateEstimate option
    MigrationTaskService.State migrationState = validMigrationState(ExampleService.FACTORY_LINK);
    migrationState.migrationOptions = EnumSet.of(MigrationOption.ESTIMATE_COUNT);
    Operation post = Operation.createPost(this.destinationFactoryUri).setBody(migrationState);
    ServiceDocument taskState = this.sender.sendAndWait(post, ServiceDocument.class);
    State finalState = waitForServiceCompletion(taskState.documentSelfLink, getDestinationHost());
    assertEquals(TaskStage.FINISHED, finalState.taskInfo.stage);
    // verify stats
    ServiceStats stats = this.sender.sendStatsGetAndWait(UriUtils.buildUri(getDestinationHost(), taskState.documentSelfLink));
    ServiceStat statValue = stats.entries.get(MigrationTaskService.STAT_NAME_ESTIMATED_TOTAL_SERVICE_COUNT);
    assertNotNull("estimatedTotalServiceCount should be populated", statValue);
    assertEquals("estimatedTotalServiceCount", this.serviceCount, (long) statValue.latestValue);
}