PluginInfo { public String getId(T pluginImpl) { return pluginImpl.getClass().getName(); } PluginInfo(Class<T> pluginClass);  PluginInfo(Class<T> pluginClass, String pluginName); Class<T> getPluginClass(); String getPluginName(); String getId(T pluginImpl); @Override String toString();  }
@Test public void testPluginDetails() { new ServiceLoaderCache<>(A.class).getServices().forEach(a -> assertNotNull(pluginInfo.getId(a)) ); }
@Test public void testGetPluginInfoId() { A1 a1 = new A1(); A2 a2 = new A2(); assertEquals("A1", pluginInfo.getId(a1)); assertEquals("A2", pluginInfo.getId(a2)); }
@Test public void testGetPluginInfoIdDefault() { PluginInfo<B> pluginInfoB = Plugins.getPluginInfoByName(PluginInfoB.PLUGIN_NAME); B b1 = () -> "B1"; String bPluginID = pluginInfoB.getId(b1); assertNotEquals("B1", bPluginID); assertEquals(b1.getClass().getName(), bPluginID); }