]> source.dussan.org Git - pf4j.git/commitdiff
Added one more fail test to DefaultPluginFactory
authorMário Franco <mario.ffranco@gmail.com>
Tue, 21 Jul 2015 13:17:17 +0000 (14:17 +0100)
committerMário Franco <mario.ffranco@gmail.com>
Wed, 9 Sep 2015 11:02:24 +0000 (12:02 +0100)
pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginFactoryTest.java

index 203aa02de13445b8be7bb4d84e00945c9de0531d..e32b4dce4db930d65ba57735728e2c2670f71a35 100644 (file)
@@ -72,6 +72,24 @@ public class DefaultPluginFactoryTest {
         assertNull(result);
     }
 
+    /**
+     * Test of create method, of class DefaultPluginFactory.
+     */
+    @Test
+    public void testCreateFailNotFound() {
+        PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
+        when(pluginDescriptor.getPluginClass()).thenReturn("ro.fortsoft.pf4j.plugin.NotFoundTestPlugin");
+
+        PluginWrapper pluginWrapper = mock(PluginWrapper.class);
+        when(pluginWrapper.getDescriptor()).thenReturn(pluginDescriptor);
+        when(pluginWrapper.getPluginClassLoader()).thenReturn(getClass().getClassLoader());
+
+        DefaultPluginFactory instance = new DefaultPluginFactory();
+
+        Plugin result = instance.create(pluginWrapper);
+        assertNull(result);
+    }
+
     /**
      * Test of create method, of class DefaultPluginFactory.
      */