factor out swap method in MigrationHandlingTest