MigraMongo { public MigraMongoStatus dryRun() { try { final List<MongoMigrationScript> migrationScriptsToApply = findMigrationScriptsToApply(); final MigraMongoStatus status = MigraMongoStatus.ok(); migrationScriptsToApply.stream().forEach(ms -> { final MigrationEntry migEntry = new MigrationEntry(); migEntry.setFromVersion(ms.getMigrationInfo().getFromVersion()); migEntry.setToVersion(ms.getMigrationInfo().getToVersion()); migEntry.setInfo("Dummy migration entry - migration has not been performed"); status.addEntry(migEntry); }); return status; } catch (MongoMigrationException e) { return e.getStatus(); } } MigraMongo(
            MongoDatabase database,
            MigrationHistoryService migrationEntryService,
            LockService lockService,
            ScriptLookupService scriptLookupService); void setAsyncInitializerFunction(Runnable function); MigraMongoStatus dryRun(); MigraMongoStatus migrate(); MigraMongoStatus migrateAsync(); MigraMongoStatus status(String fromVersion); MigraMongoStatus repair(String fromVersion, String toVersion); MigraMongoStatus rerun(String fromVersion, String toVersion); List<MigrationEntry> getMigrationEntries(); void destroyLocks();  }
@Test public void shouldReturnStatusInDryRunWhenNoInitialScriptFound() throws Exception { final MigraMongoStatus status = migraMongo.dryRun(); assertThat(status.status, is(MigrationStatus.OK)); assertThat(status.migrationsApplied, hasSize(0)); }
@Test public void shouldReturnErrorStatusInDryRunWhenExceptionIsThrown() throws Exception { mockLastMigrationApplied("1", "2", MigrationStatus.ERROR); final MigraMongoStatus status = migraMongo.dryRun(); assertThat(status.status, is(MigrationStatus.ERROR)); assertThat(status.migrationsApplied, hasSize(0)); }