]> source.dussan.org Git - pf4j.git/commitdiff
Fix test
authorDecebal Suiu <decebal.suiu@gmail.com>
Tue, 21 Mar 2023 07:50:07 +0000 (09:50 +0200)
committerDecebal Suiu <decebal.suiu@gmail.com>
Tue, 21 Mar 2023 07:50:07 +0000 (09:50 +0200)
pf4j/src/test/java/org/pf4j/LoadPluginsTest.java

index 189bd0a2f49609ccb7228c33b565a0463c51e823..a03528ca178207f3e964932f050ddb0716ba0510 100644 (file)
@@ -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()));
     }