@Test(expected = KernelException.class) public void test_assertUniqueness_with_class_conflict() { underTest.add(new MyPlugin()); underTest.add(new MyPlugin()); }
void add(Class<? extends Plugin> pluginClass) { try { add(pluginClass.newInstance()); } catch (InstantiationException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } catch (IllegalAccessException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } }
PluginRegistry { void add(Class<? extends Plugin> pluginClass) { try { add(pluginClass.newInstance()); } catch (InstantiationException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } catch (IllegalAccessException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } } }
PluginRegistry { void add(Class<? extends Plugin> pluginClass) { try { add(pluginClass.newInstance()); } catch (InstantiationException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } catch (IllegalAccessException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } }  }
PluginRegistry { void add(Class<? extends Plugin> pluginClass) { try { add(pluginClass.newInstance()); } catch (InstantiationException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } catch (IllegalAccessException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } }  Map<String, Plugin> getPluginsByName(); }
PluginRegistry { void add(Class<? extends Plugin> pluginClass) { try { add(pluginClass.newInstance()); } catch (InstantiationException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } catch (IllegalAccessException e) { throw new KernelException("Plugin %s can not be instantiated", pluginClass); } }  Map<String, Plugin> getPluginsByName();  }