From c1f799cce8aa7e6ddee3385f6ff7dda8488f7553 Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A1rio=20Franco?= Date: Tue, 21 Jul 2015 14:17:17 +0100 Subject: [PATCH] Added one more fail test to DefaultPluginFactory --- .../pf4j/DefaultPluginFactoryTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginFactoryTest.java b/pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginFactoryTest.java index 203aa02..e32b4dc 100644 --- a/pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginFactoryTest.java +++ b/pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginFactoryTest.java @@ -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. */ -- 2.39.5