### Question:
FlowPersistenceProviderMigrator { public void doMigrate(MetadataService fromMetadata, FlowPersistenceProvider fromProvider, FlowPersistenceProvider toProvider) { for (BucketEntity bucket : fromMetadata.getAllBuckets()) { for (FlowEntity flow : fromMetadata.getFlowsByBucket(bucket.getId())) { for (FlowSnapshotEntity flowSnapshot : fromMetadata.getSnapshots(flow.getId())) { StandardFlowSnapshotContext context = new StandardFlowSnapshotContext.Builder( BucketMappings.map(bucket), FlowMappings.map(bucket, flow), FlowMappings.map(bucket, flowSnapshot)).build(); int version = flowSnapshot.getVersion(); toProvider.saveFlowContent(context, fromProvider.getFlowContent(bucket.getId(), flow.getId(), version)); log.info("Migrated flow {} version {}", flow.getName(), version); } } } }  void doMigrate(MetadataService fromMetadata, FlowPersistenceProvider fromProvider, FlowPersistenceProvider toProvider); static void main(String[] args); static final int PARSE_EXCEPTION; }### Answer:
@Test public void testMigration() { createBucket("bucket1"); BucketEntity bucket2 = createBucket("bucket2"); BucketEntity bucket3 = createBucket("bucket3"); FlowEntity flow1 = createFlow(bucket2, "flow1"); FlowEntity flow2 = createFlow(bucket3, "flow2"); FlowEntity flow3 = createFlow(bucket3, "flow3"); List<FlowSnapshotEntity> snapshots = Arrays.asList( createSnapshot(flow1, 1), createSnapshot(flow2, 1), createSnapshot(flow2, 2), createSnapshot(flow3, 1), createSnapshot(flow3, 2), createSnapshot(flow3, 3)); new FlowPersistenceProviderMigrator().doMigrate(metadataService, fromProvider, toProvider); for (FlowSnapshotEntity snapshot : snapshots) { verifyMigrate(snapshot); } verifyNoMoreInteractions(toProvider); }