PluginInstaller returns now PendingPluginInstallation, to abort the installation before restart

This commit is contained in:
Sebastian Sdorra
2019-08-20 16:38:29 +02:00
parent e24673be0a
commit 8db2bbb28d
5 changed files with 100 additions and 3 deletions

View File

@@ -51,6 +51,17 @@ class PluginInstallerTest {
assertThat(directory.resolve("plugins").resolve("scm-git-plugin.smp")).hasContent("42");
}
@Test
void shouldReturnPendingPluginInstallation() throws IOException {
mockContent("42");
AvailablePlugin gitPlugin = createGitPlugin();
PendingPluginInstallation pending = installer.install(gitPlugin);
assertThat(pending).isNotNull();
assertThat(pending.getPlugin()).isSameAs(gitPlugin);
}
private void mockContent(String content) throws IOException {
when(client.get("https://download.hitchhiker.com").request().contentAsStream())
.thenReturn(new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)));