use of org.jqassistant.schema.plugin.v1.JqassistantPlugin in project jqa-core-framework by buschmais.
the class PluginConfigurationReaderImplTest method twoPluginsWithTheSameIdCausesAnPluginRepositoryException.
@Test
void twoPluginsWithTheSameIdCausesAnPluginRepositoryException() throws Exception {
List<URL> urls = Arrays.asList(new URL("file://1"), new URL("file://2"));
Enumeration<URL> enumerationOfUrls = Iterators.asEnumeration(urls.iterator());
PluginConfigurationReaderImpl reader = Mockito.mock(PluginConfigurationReaderImpl.class);
JqassistantPlugin plugin1 = Mockito.mock(JqassistantPlugin.class);
JqassistantPlugin plugin2 = Mockito.mock(JqassistantPlugin.class);
Mockito.doReturn("Plugin A").when(plugin1).getName();
Mockito.doReturn("id_snafu").when(plugin1).getId();
Mockito.doReturn("Plugin B").when(plugin2).getName();
Mockito.doReturn("id_snafu").when(plugin2).getId();
Mockito.doReturn(plugin1).doReturn(plugin2).when(reader).readPlugin(Mockito.any(URL.class));
Mockito.doReturn(enumerationOfUrls).when(reader).getPluginClassLoaderResources();
Mockito.doCallRealMethod().when(reader).getPlugins();
Assertions.assertThatThrownBy(reader::getPlugins).isInstanceOf(PluginRepositoryException.class);
}
Aggregations