### Question:
UpdateManager implements InitializingBean { public boolean isUpdateAvailable() { try { return getLatestVersion().isUpdateFor(currentVersion) && !latestVersionIgnored() && !latestVersionBlocked() && latestVersionFinalOrPreEnabled(); } catch (UpdateException e) { logger.error("Error while checking if new version is available", e); return false; } } UpdateManager(); boolean isUpdateAvailable(); boolean latestVersionFinalOrPreEnabled(); boolean latestVersionIgnored(); boolean latestVersionBlocked(); String getLatestVersionString(); String getCurrentVersionString(); void ignore(String version); List<ChangelogVersionEntry> getChangesSinceCurrentVersion(); List<ChangelogVersionEntry> getAllVersionChangesUpToCurrentVersion(); List<ChangelogVersionEntry> getAutomaticUpdateVersionHistory(); void installUpdate(boolean isAutomaticUpdate); void exitWithReturnCode(final int returnCode); @Override void afterPropertiesSet(); PackageInfo getPackageInfo(); static final int SHUTDOWN_RETURN_CODE; static final int UPDATE_RETURN_CODE; static final int RESTART_RETURN_CODE; static final int RESTORE_RETURN_CODE; static final String KEY; }### Answer:
@Test public void testThatChecksForUpdateAvailable() throws Exception { assertTrue(testee.isUpdateAvailable()); testee.currentVersion = new SemanticVersion("v2.0.0"); assertFalse(testee.isUpdateAvailable()); }
@Test public void testThatChecksForUpdateAvailableWithPrerelease() throws Exception { assertTrue(testee.isUpdateAvailable()); configProviderMock.getBaseConfig().getMain().setUpdateToPrereleases(true); testee.currentVersion = new SemanticVersion("v2.3.4"); assertFalse(testee.isUpdateAvailable()); }