AbstractThreadedObservablePlugin extends AbstractObservablePlugin { @Override public final void addObserver(final ObservablePlugin.PluginObserver observer) { super.addObserver(observer); if (countObservers() == 1) { if (logger.isDebugEnabled()) { logger.debug("Start monitoring the plugin {}", this.getName()); } thread = new EventThread(this.getName()); thread.start(); } } protected  AbstractThreadedObservablePlugin(String name); @Override final void addObserver(final ObservablePlugin.PluginObserver observer); @Override final void removeObserver(final ObservablePlugin.PluginObserver observer); @Override final void clearObservers();  }
@Test public void addObserver() throws Throwable { MockAbstractThreadedPlugin plugin = new MockAbstractThreadedPlugin("addObserverTest"); plugin.addObserver(getOneObserver()); Assert.assertEquals(1, plugin.countObservers()); Assert.assertTrue(plugin.isMonitoring()); plugin.finalize(); }