@Test public void installed_fails_with_ISE_if_called_before_setLoadedCoreExtensions() { CoreExtension coreExtension = newCoreExtension(); expectRepositoryNotInitializedISE(); underTest.installed(coreExtension); }
private static CoreExtension newCoreExtension() { String name = "name_" + nameCounter; nameCounter++; return newCoreExtension(name); }
@Test public void isInstalled_fails_with_ISE_if_called_before_setLoadedCoreExtensions() { expectRepositoryNotInitializedISE(); underTest.isInstalled("foo"); }
@DataProvider public static Object[][] coreExtensionsSets() { return new Object[][] { {emptySet()}, {singleton(newCoreExtension())}, {ImmutableSet.of(newCoreExtension(), newCoreExtension())}, }; }
@Test public void loadedCoreExtensions_fails_with_ISE_if_called_before_setLoadedCoreExtensions() { expectRepositoryNotInitializedISE(); underTest.loadedCoreExtensions(); }
@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 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_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); }