Search in sources :

Example 16 with JqassistantPlugin

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);
}
Also used : JqassistantPlugin(org.jqassistant.schema.plugin.v1.JqassistantPlugin) URL(java.net.URL) Test(org.junit.jupiter.api.Test)

Aggregations

JqassistantPlugin (org.jqassistant.schema.plugin.v1.JqassistantPlugin)12 IdClassListType (org.jqassistant.schema.plugin.v1.IdClassListType)5 Test (org.junit.jupiter.api.Test)5 PluginRepositoryException (com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException)3 JqassistantPlugin (com.buschmais.jqassistant.core.plugin.schema.v1.JqassistantPlugin)3 URL (java.net.URL)3 HashMap (java.util.HashMap)3 IdClassType (org.jqassistant.schema.plugin.v1.IdClassType)3 AnalyzerPluginRepository (com.buschmais.jqassistant.core.analysis.spi.AnalyzerPluginRepository)2 PluginConfigurationReader (com.buschmais.jqassistant.core.plugin.api.PluginConfigurationReader)2 PluginInfo (com.buschmais.jqassistant.core.plugin.api.PluginInfo)2 PluginRepository (com.buschmais.jqassistant.core.plugin.api.PluginRepository)2 Scope (com.buschmais.jqassistant.core.scanner.api.Scope)2 ScannerPluginRepository (com.buschmais.jqassistant.core.scanner.spi.ScannerPluginRepository)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 RuleInterpreterPlugin (com.buschmais.jqassistant.core.analysis.api.RuleInterpreterPlugin)1 IdClassType (com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType)1 ReportType (com.buschmais.jqassistant.core.plugin.schema.v1.ReportType)1 RulesType (com.buschmais.jqassistant.core.plugin.schema.v1.RulesType)1 ScopeType (com.buschmais.jqassistant.core.plugin.schema.v1.ScopeType)1