### Question:
CodedMigrationService implements MigrationService { @VisibleForTesting boolean versionGapNeedsThisMigration(Version currentVersion, Version toVersion, CodedMigration migration) { return currentVersion.equals(migration.from()) && toVersion.equals(migration.to()); } @Inject protected  CodedMigrationService(
			@Named(LoggerModule.MIGRATION) Logger logger,
			Provider<Session> sessionProvider,
			DatabaseConnectionProvider dbcp,
			DatabaseDriverConfigurationProvider databaseDriverConfigurationProvider); @Override void migrate(Version currentVersion, Version toVersion);  }### Answer:
@Test public void needsThisMigrationShouldBeFalseWhenSameFromButDifferentTo() { Version currentVersion = Version.of(2); Version toVersion = Version.of(3); CodedMigration migration = new TestCodedMigration(currentVersion, Version.of(4)); assertThat(testee.versionGapNeedsThisMigration(currentVersion, toVersion, migration)).isFalse(); }
@Test public void needsThisMigrationShouldBeFalseWhenDifferentFromButSameTo() { Version currentVersion = Version.of(2); Version toVersion = Version.of(3); CodedMigration migration = new TestCodedMigration(Version.of(1), toVersion); assertThat(testee.versionGapNeedsThisMigration(currentVersion, toVersion, migration)).isFalse(); }
@Test public void needsThisMigrationShouldBeFalseWhenBothDifferent() { Version currentVersion = Version.of(2); Version toVersion = Version.of(5); CodedMigration migration = new TestCodedMigration(Version.of(3), Version.of(4)); assertThat(testee.versionGapNeedsThisMigration(currentVersion, toVersion, migration)).isFalse(); }
@Test public void needsThisMigrationShouldBeTrueWhenSameFromAndTo() { Version currentVersion = Version.of(2); Version toVersion = Version.of(3); CodedMigration migration = new TestCodedMigration(currentVersion, toVersion); assertThat(testee.versionGapNeedsThisMigration(currentVersion, toVersion, migration)).isTrue(); }