RegisteredPlugin implements Comparable<RegisteredPlugin> { public boolean isInstanceOf(final Class<? extends IPlugin> clazz) { try (final Jar jar = this.file.getJar()) { return jar.getEntry("META-INF/services/" + clazz.getName()) != null; } catch (IOException e) { LOGGER.log(WARNING, "Can not determine instance of " + clazz, e); return false; } } RegisteredPlugin(PluginFile file); PluginFile getFile(); String getName(); String getVersion(); String getDescription(); String getIconName(); byte[] getIcon(); IPlugin getInstance(); boolean isInstanceOf(final Class<? extends IPlugin> clazz); boolean install(); void uninstall(); boolean isInstalled(); boolean start(); void stop(); boolean isStarted(); @Override int compareTo(RegisteredPlugin o); @Override boolean equals(Object o); @Override int hashCode();  }
@Test void pluginIsNotInstanceOf() throws IOException { final File plugin = PluginTestUtils.createDummyPlugin("my-plugin", "Awesome plugin", "1.0"); final RegisteredPlugin registeredPlugin = new RegisteredPlugin(new PluginFile(plugin)); assertFalse(registeredPlugin.isInstanceOf(AbstractPlugin.class)); }
@Test void pluginIsInstanceOf() throws IOException { final File plugin = PluginTestUtils.createDummyPlugin("my-plugin", "Awesome plugin", "1.0"); final RegisteredPlugin registeredPlugin = new RegisteredPlugin(new PluginFile(plugin)); assertTrue(registeredPlugin.isInstanceOf(IPlugin.class)); }