@Test
public void handsOutInstallationFromConnectionWhenNewerIsAvailable() throws Exception {
InstallableUpdate update = mock(InstallableUpdate.class);
when(update.isUpdateFrom(currentVersion)).thenReturn(UpdateAvailability.Available);
when(connection.getLatestAvailableUpdate()).thenReturn(update);
OngoingInstallation installation = mock(OngoingInstallation.class);
when(update.install()).thenReturn(installation);
UpdateCheck check = createExecutedUpdateCheck();
OngoingInstallation actualInstallation = check.updateToLatestVersion();
assertThat(actualInstallation, is(installation));
}