@Test @UseDataProvider("coreExtensionsSets") public void isInstalled_returns_false_for_not_loaded_CoreExtension(Set<CoreExtension> coreExtensions) { underTest.setLoadedCoreExtensions(coreExtensions); assertThat(underTest.isInstalled("not loaded")).isFalse(); }
@Test public void setLoadedCoreExtensions_fails_with_NPE_if_argument_is_null() { expectedException.expect(NullPointerException.class); underTest.setLoadedCoreExtensions(null); }
@Test @UseDataProvider("coreExtensionsSets") public void setLoadedCoreExtensions_fails_with_ISE_if_called_twice(Set<CoreExtension> coreExtensions) { underTest.setLoadedCoreExtensions(coreExtensions); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Repository has already been initialized"); underTest.setLoadedCoreExtensions(coreExtensions); }
@Test public void isInstalled_returns_false_for_loaded_but_not_installed_CoreExtension() { CoreExtension coreExtension = newCoreExtension(); underTest.setLoadedCoreExtensions(singleton(coreExtension)); assertThat(underTest.isInstalled(coreExtension.getName())).isFalse(); }
@Test @UseDataProvider("coreExtensionsSets") public void loadedCoreExtensions_returns_CoreExtensions_from_setLoadedCoreExtensions(Set<CoreExtension> coreExtensions) { underTest.setLoadedCoreExtensions(coreExtensions); assertThat(underTest.loadedCoreExtensions().collect(Collectors.toSet())) .isEqualTo(coreExtensions); }
@Test public void isInstalled_returns_true_for_loaded_and_installed_CoreExtension() { CoreExtension coreExtension = newCoreExtension(); underTest.setLoadedCoreExtensions(singleton(coreExtension)); underTest.installed(coreExtension); assertThat(underTest.isInstalled(coreExtension.getName())).isTrue(); }
@Test @UseDataProvider("coreExtensionsSets") public void installed_fails_with_NPE_if_CoreExtension_is_null(Set<CoreExtension> coreExtensions) { underTest.setLoadedCoreExtensions(coreExtensions); expectedException.expect(NullPointerException.class); expectedException.expectMessage("coreExtension can't be null"); underTest.installed(null); }
@Test @UseDataProvider("coreExtensionsSets") public void installed_fails_with_IAE_if_CoreExtension_is_not_loaded(Set<CoreExtension> coreExtensions) { underTest.setLoadedCoreExtensions(coreExtensions); CoreExtension coreExtension = newCoreExtension(); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Specified CoreExtension has not been loaded first"); underTest.installed(coreExtension); }