@Test public void shouldNotBeUpgraded() { DatabaseVersion dbVersion = mock(DatabaseVersion.class); when(dbVersion.getVersion()).thenReturn(DatabaseVersion.LAST_VERSION); DefaultServerUpgradeStatus status = new DefaultServerUpgradeStatus(dbVersion); status.start(); assertThat(status.isFreshInstall(), is(false)); assertThat(status.isUpgraded(), is(false)); assertThat(status.getInitialDbVersion(), is(DatabaseVersion.LAST_VERSION)); }
@Test public void shouldBeFreshInstallation() { DatabaseVersion dbVersion = mock(DatabaseVersion.class); when(dbVersion.getVersion()).thenReturn(null); DefaultServerUpgradeStatus status = new DefaultServerUpgradeStatus(dbVersion); status.start(); assertThat(status.isFreshInstall(), is(true)); assertThat(status.isUpgraded(), is(false)); assertThat(status.getInitialDbVersion(), is(-1)); }