aboutsummaryrefslogtreecommitdiffstats
path: root/pf4j/src/test
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2019-06-08 22:49:38 +0300
committerDecebal Suiu <decebal.suiu@gmail.com>2019-06-08 22:49:54 +0300
commite81d9054f721dbd2900fb6190b4326e47dd0f1fd (patch)
treebaf44fb745746f6e8fba09339a6ec679411671ed /pf4j/src/test
parent553a0753f59870b29515b05013ad4f1a0ef547d7 (diff)
downloadpf4j-e81d9054f721dbd2900fb6190b4326e47dd0f1fd.tar.gz
pf4j-e81d9054f721dbd2900fb6190b4326e47dd0f1fd.zip
Convert PluginException in PluginRuntimeException and use unchecked exceptions
Diffstat (limited to 'pf4j/src/test')
-rw-r--r--pf4j/src/test/java/org/pf4j/CompoundPluginDescriptorFinderTest.java2
-rw-r--r--pf4j/src/test/java/org/pf4j/DefaultExtensionFactoryTest.java4
-rw-r--r--pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java8
-rw-r--r--pf4j/src/test/java/org/pf4j/DefaultPluginRepositoryTest.java2
-rw-r--r--pf4j/src/test/java/org/pf4j/LoadPluginsTest.java4
-rw-r--r--pf4j/src/test/java/org/pf4j/ManifestPluginDescriptorFinderTest.java2
-rw-r--r--pf4j/src/test/java/org/pf4j/PropertiesPluginDescriptorFinderTest.java2
-rw-r--r--pf4j/src/test/java/org/pf4j/SingletonExtensionFactoryTest.java4
8 files changed, 14 insertions, 14 deletions
diff --git a/pf4j/src/test/java/org/pf4j/CompoundPluginDescriptorFinderTest.java b/pf4j/src/test/java/org/pf4j/CompoundPluginDescriptorFinderTest.java
index d74bea3..c16839e 100644
--- a/pf4j/src/test/java/org/pf4j/CompoundPluginDescriptorFinderTest.java
+++ b/pf4j/src/test/java/org/pf4j/CompoundPluginDescriptorFinderTest.java
@@ -87,7 +87,7 @@ public class CompoundPluginDescriptorFinderTest {
@Test
public void testNotFound() {
PluginDescriptorFinder descriptorFinder = new CompoundPluginDescriptorFinder();
- assertThrows(PluginException.class, () -> descriptorFinder.find(pluginsPath.resolve("test-plugin-3")));
+ assertThrows(PluginRuntimeException.class, () -> descriptorFinder.find(pluginsPath.resolve("test-plugin-3")));
}
@Test
diff --git a/pf4j/src/test/java/org/pf4j/DefaultExtensionFactoryTest.java b/pf4j/src/test/java/org/pf4j/DefaultExtensionFactoryTest.java
index 207c178..150828f 100644
--- a/pf4j/src/test/java/org/pf4j/DefaultExtensionFactoryTest.java
+++ b/pf4j/src/test/java/org/pf4j/DefaultExtensionFactoryTest.java
@@ -45,7 +45,7 @@ public class DefaultExtensionFactoryTest {
* Test of create method, of class DefaultExtensionFactory.
*/
@Test
- public void testCreate() throws PluginException {
+ public void testCreate() {
assertNotNull(extensionFactory.create(TestExtension.class));
}
@@ -54,7 +54,7 @@ public class DefaultExtensionFactoryTest {
*/
@Test
public void testCreateFailConstructor() {
- assertThrows(PluginException.class, () -> extensionFactory.create(FailTestExtension.class));
+ assertThrows(PluginRuntimeException.class, () -> extensionFactory.create(FailTestExtension.class));
}
}
diff --git a/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java b/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java
index ced9b4e..8cb9b27 100644
--- a/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java
+++ b/pf4j/src/test/java/org/pf4j/DefaultPluginManagerTest.java
@@ -65,24 +65,24 @@ public class DefaultPluginManagerTest {
}
@Test
- public void validateOK() throws PluginException {
+ public void validateOK() {
pluginManager.validatePluginDescriptor(pluginDescriptor);
}
@Test
public void validateFailsOnId() {
pluginDescriptor.setPluginId("");
- assertThrows(PluginException.class, () -> pluginManager.validatePluginDescriptor(pluginDescriptor));
+ assertThrows(PluginRuntimeException.class, () -> pluginManager.validatePluginDescriptor(pluginDescriptor));
}
@Test
public void validateFailsOnVersion() {
pluginDescriptor.setPluginVersion(null);
- assertThrows(PluginException.class, () -> pluginManager.validatePluginDescriptor(pluginDescriptor));
+ assertThrows(PluginRuntimeException.class, () -> pluginManager.validatePluginDescriptor(pluginDescriptor));
}
@Test
- public void validateNoPluginClass() throws PluginException {
+ public void validateNoPluginClass() {
pluginManager.validatePluginDescriptor(pluginDescriptor);
assertEquals(Plugin.class.getName(), pluginDescriptor.getPluginClass());
}
diff --git a/pf4j/src/test/java/org/pf4j/DefaultPluginRepositoryTest.java b/pf4j/src/test/java/org/pf4j/DefaultPluginRepositoryTest.java
index 3474aa6..c564543 100644
--- a/pf4j/src/test/java/org/pf4j/DefaultPluginRepositoryTest.java
+++ b/pf4j/src/test/java/org/pf4j/DefaultPluginRepositoryTest.java
@@ -67,7 +67,7 @@ public class DefaultPluginRepositoryTest {
* Test of {@link DefaultPluginRepository#deletePluginPath(Path)} method.
*/
@Test
- public void testDeletePluginPath() throws PluginException {
+ public void testDeletePluginPath() {
PluginRepository repository = new DefaultPluginRepository(pluginsPath);
assertTrue(Files.exists(pluginsPath.resolve("plugin-1.zip")));
diff --git a/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java b/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java
index d2a7e25..e3dac02 100644
--- a/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java
+++ b/pf4j/src/test/java/org/pf4j/LoadPluginsTest.java
@@ -102,7 +102,7 @@ public class LoadPluginsTest {
// Verify the second plugin is not loaded as it has the same metadata
pluginManager.loadPluginFromPath(plugin2.path());
fail("Expected loadPluginFromPath to fail");
- } catch (PluginException e) {
+ } catch (PluginRuntimeException e) {
// Check the path of the loaded plugin remains the same
PluginWrapper loadedPlugin = pluginManager.getPlugin(pluginId);
assertThat(loadedPlugin.getPluginPath(), equalTo(loadedPlugin1Path));
@@ -141,7 +141,7 @@ public class LoadPluginsTest {
// Verify the second plugin is not loaded as it has the same pluginId
pluginManager.loadPluginFromPath(plugin2.path());
fail("Expected loadPluginFromPath to fail");
- } catch (PluginException e) {
+ } catch (PluginRuntimeException e) {
// Check the path and version of the loaded plugin remain the same
PluginWrapper loadedPlugin = pluginManager.getPlugin(pluginId);
assertThat(loadedPlugin.getPluginPath(), equalTo(loadedPlugin1Path));
diff --git a/pf4j/src/test/java/org/pf4j/ManifestPluginDescriptorFinderTest.java b/pf4j/src/test/java/org/pf4j/ManifestPluginDescriptorFinderTest.java
index 2ffe01b..468f2fb 100644
--- a/pf4j/src/test/java/org/pf4j/ManifestPluginDescriptorFinderTest.java
+++ b/pf4j/src/test/java/org/pf4j/ManifestPluginDescriptorFinderTest.java
@@ -107,7 +107,7 @@ public class ManifestPluginDescriptorFinderTest {
@Test
public void testFindNotFound() {
PluginDescriptorFinder descriptorFinder = new ManifestPluginDescriptorFinder();
- assertThrows(PluginException.class, () -> descriptorFinder.find(pluginsPath.resolve("test-plugin-3")));
+ assertThrows(PluginRuntimeException.class, () -> descriptorFinder.find(pluginsPath.resolve("test-plugin-3")));
}
private Manifest getPlugin1Manifest() {
diff --git a/pf4j/src/test/java/org/pf4j/PropertiesPluginDescriptorFinderTest.java b/pf4j/src/test/java/org/pf4j/PropertiesPluginDescriptorFinderTest.java
index 1f51e95..bc91a7f 100644
--- a/pf4j/src/test/java/org/pf4j/PropertiesPluginDescriptorFinderTest.java
+++ b/pf4j/src/test/java/org/pf4j/PropertiesPluginDescriptorFinderTest.java
@@ -104,7 +104,7 @@ public class PropertiesPluginDescriptorFinderTest {
@Test
public void testNotFound() {
PluginDescriptorFinder descriptorFinder = new PropertiesPluginDescriptorFinder();
- assertThrows(PluginException.class, () -> descriptorFinder.find(pluginsPath.resolve("test-plugin-3")));
+ assertThrows(PluginRuntimeException.class, () -> descriptorFinder.find(pluginsPath.resolve("test-plugin-3")));
}
private Properties getPlugin1Properties() {
diff --git a/pf4j/src/test/java/org/pf4j/SingletonExtensionFactoryTest.java b/pf4j/src/test/java/org/pf4j/SingletonExtensionFactoryTest.java
index 97e98cf..80e7ab0 100644
--- a/pf4j/src/test/java/org/pf4j/SingletonExtensionFactoryTest.java
+++ b/pf4j/src/test/java/org/pf4j/SingletonExtensionFactoryTest.java
@@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertSame;
public class SingletonExtensionFactoryTest {
@Test
- public void create() throws PluginException {
+ public void create() {
ExtensionFactory extensionFactory = new SingletonExtensionFactory();
Object extensionOne = extensionFactory.create(TestExtension.class);
Object extensionTwo = extensionFactory.create(TestExtension.class);
@@ -36,7 +36,7 @@ public class SingletonExtensionFactoryTest {
}
@Test
- public void createNewEachTime() throws PluginException {
+ public void createNewEachTime() {
ExtensionFactory extensionFactory = new SingletonExtensionFactory(FailTestExtension.class.getName());
Object extensionOne = extensionFactory.create(TestExtension.class);
Object extensionTwo = extensionFactory.create(TestExtension.class);