From: Decebal Suiu Date: Tue, 21 Mar 2023 07:50:07 +0000 (+0200) Subject: Fix test X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aa0a89a931511913b291089f9d1a7cfa6a14b742;p=pf4j.git Fix test --- diff --git a/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java b/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java index 189bd0a..a03528c 100644 --- a/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java +++ b/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java @@ -152,18 +152,19 @@ public class LoadPluginsTest { @Test public void loadUnloadLoad() throws Exception { - PluginZip pluginZip = new PluginZip.Builder(pluginsPath.resolve("my-plugin-1.2.3.zip"), "myPlugin") + String pluginId = "myPlugin"; + PluginZip pluginZip = new PluginZip.Builder(pluginsPath.resolve("my-plugin-1.2.3.zip"), pluginId) .pluginVersion("1.2.3") .build(); pluginManager.loadPlugins(); assertEquals(1, pluginManager.getPlugins().size()); - assertTrue(pluginManager.unloadPlugin(pluginManager.idForPath(pluginZip.unzippedPath()))); + assertTrue(pluginManager.unloadPlugin(pluginId)); // duplicate check assertNull(pluginManager.idForPath(pluginZip.unzippedPath())); // Double unload ok - assertFalse(pluginManager.unloadPlugin(pluginManager.idForPath(pluginZip.unzippedPath()))); + assertThrows(IllegalArgumentException.class, () -> pluginManager.unloadPlugin(pluginId), "Unknown pluginId " + pluginId); assertNotNull(pluginManager.loadPlugin(pluginZip.unzippedPath())); }