@Test(expected = PluginException.class)
public void testDuplicateProvidedDependency() throws PluginException {

    PluginRegistry pluginRegistry = new PluginRegistryContainer();
    PluginMetadata pluginMetadata = getMockPluginMetadata(PLUGIN_NAME);
    Dependency pluginDependency = new DependencyContainer(PLUGIN_NAME, "plugin-version");
    when(pluginMetadata.getDependency()).thenReturn(pluginDependency);
    Dependency providedDependency = new DependencyContainer("some-plugin", "some-version");
    when(pluginMetadata.getProvidedDependency()).thenReturn(Optional.of(providedDependency));
    pluginRegistry.addPlugin(pluginMetadata);
    pluginRegistry.addPlugin(pluginMetadata); //Adding the same plugin for the second time
}