@Test public void shouldDoNothingIfDatabaseHasAllMigrations() { mockery.checking( new Expectations() { { one(provider).getAppliedMigrations(); will(returnValue(Arrays.asList("second", "first"))); } }); Migrations migrationsToApply = migrator.getMigrationsToApply(); assertThat(migrationsToApply.size(), is(equalTo(0))); mockery.assertIsSatisfied(); }
@Test public void shouldReturnNonExecutedMigrationsIfThereAreAnyPending() { mockery.checking( new Expectations() { { one(provider).getAppliedMigrations(); will(returnValue(Arrays.asList("first"))); } }); Migrations migrationsToApply = migrator.getMigrationsToApply(); assertThat(migrationsToApply.size(), is(equalTo(1))); assertThat(migrationsToApply.getAll().iterator().next(), is(equalTo(second))); mockery.assertIsSatisfied(); }