MigraMongoJMX { @ManagedOperation public String migrateAsync() { return toJson(migraMongo.migrateAsync()); } MigraMongoJMX(MigraMongo migraMongo); @ManagedOperation String migrate(); @ManagedOperation String migrateAsync(); @ManagedOperation String dryRun(); @ManagedOperation String status(String fromVersion); @ManagedOperation Boolean needsMigration(); @ManagedOperation String history(); @ManagedOperation void destroyLocks();  }
@Test public void shouldReturnCorrectJsonWhenMigrationsAsynchApplied() { final MigraMongoStatus migraMongoStatus = MigraMongoStatus.ok().addEntry(createMigrationEntry("3.0", "4.0")); when(migraMongo.migrateAsync()).thenReturn(migraMongoStatus); final String jsonStatus = migraMongoJMX.migrateAsync(); final MigraMongoStatus status = new Gson().fromJson(jsonStatus, MigraMongoStatus.class); assertThat(status, samePropertyValuesAs(migraMongoStatus)); }