summaryrefslogtreecommitdiffstats
path: root/pf4j/src
diff options
context:
space:
mode:
authorMário Franco <mario.ffranco@gmail.com>2015-07-21 15:55:48 +0100
committerMário Franco <mario.ffranco@gmail.com>2015-09-09 12:02:25 +0100
commit13ace71e16d865d620177dc176cafa5ced28e67b (patch)
treecb1ba767f7c66272db667137e7ce32daaa6281aa /pf4j/src
parentaa35da32f675302bb0bafcdd4d57af3c6882d1fb (diff)
downloadpf4j-13ace71e16d865d620177dc176cafa5ced28e67b.tar.gz
pf4j-13ace71e16d865d620177dc176cafa5ced28e67b.zip
Added more fail tests
Diffstat (limited to 'pf4j/src')
-rw-r--r--pf4j/src/test/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinderTest.java27
-rw-r--r--pf4j/src/test/resources/test-plugin-4/classes/META-INF/MANIFEST.MF14
-rw-r--r--pf4j/src/test/resources/test-plugin-5/classes/META-INF/MANIFEST.MF14
3 files changed, 52 insertions, 3 deletions
diff --git a/pf4j/src/test/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinderTest.java b/pf4j/src/test/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinderTest.java
index 2007ba0..10109d4 100644
--- a/pf4j/src/test/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinderTest.java
+++ b/pf4j/src/test/java/ro/fortsoft/pf4j/ManifestPluginDescriptorFinderTest.java
@@ -31,7 +31,6 @@ import static org.junit.Assert.assertTrue;
*/
public class ManifestPluginDescriptorFinderTest {
-
@Before
public void setUp() {
}
@@ -45,7 +44,7 @@ public class ManifestPluginDescriptorFinderTest {
*/
@Test
public void testFind() throws Exception {
- ManifestPluginDescriptorFinder instance = new DefaultPluginDescriptorFinder(new PluginClasspath());
+ DefaultPluginDescriptorFinder instance = new DefaultPluginDescriptorFinder(new PluginClasspath());
URL url = getClass().getResource("/test-plugin-1");
PluginDescriptor plugin1 = instance.find(new File(url.getPath()));
url = getClass().getResource("/test-plugin-2");
@@ -74,7 +73,7 @@ public class ManifestPluginDescriptorFinderTest {
/**
* Test of find method, of class ManifestPluginDescriptorFinder.
*/
- @Test(expected=PluginException.class)
+ @Test(expected = PluginException.class)
public void testFindNotFound() throws Exception {
ManifestPluginDescriptorFinder instance = new DefaultPluginDescriptorFinder(new PluginClasspath());
@@ -82,4 +81,26 @@ public class ManifestPluginDescriptorFinderTest {
PluginDescriptor result = instance.find(new File(url.getPath()));
}
+ /**
+ * Test of find method, of class ManifestPluginDescriptorFinder.
+ */
+ @Test(expected = PluginException.class)
+ public void testFindMissingPluginClass() throws Exception {
+
+ ManifestPluginDescriptorFinder instance = new DefaultPluginDescriptorFinder(new PluginClasspath());
+ URL url = getClass().getResource("/test-plugin-4");
+ PluginDescriptor result = instance.find(new File(url.getPath()));
+ }
+
+ /**
+ * Test of find method, of class ManifestPluginDescriptorFinder.
+ */
+ @Test(expected = PluginException.class)
+ public void testFindMissingPluginVersion() throws Exception {
+
+ ManifestPluginDescriptorFinder instance = new DefaultPluginDescriptorFinder(new PluginClasspath());
+ URL url = getClass().getResource("/test-plugin-5");
+ PluginDescriptor result = instance.find(new File(url.getPath()));
+ }
+
}
diff --git a/pf4j/src/test/resources/test-plugin-4/classes/META-INF/MANIFEST.MF b/pf4j/src/test/resources/test-plugin-4/classes/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..95d8b81
--- /dev/null
+++ b/pf4j/src/test/resources/test-plugin-4/classes/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Implementation-Title: Test Plugin #2
+Implementation-Version: 0.10.0-SNAPSHOT
+Archiver-Version: Plexus Archiver
+Built-By: Mario Franco
+Specification-Title: Test Plugin #2
+Implementation-Vendor-Id: ro.fortsoft.pf4j.demo
+Plugin-Version: 0.0.1
+Plugin-Id: test-plugin-2
+Plugin-Provider: Decebal Suiu
+Created-By: Apache Maven 3.0.5
+Build-Jdk: 1.8.0_45
+Specification-Version: 0.10.0-SNAPSHOT
+
diff --git a/pf4j/src/test/resources/test-plugin-5/classes/META-INF/MANIFEST.MF b/pf4j/src/test/resources/test-plugin-5/classes/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9ab8968
--- /dev/null
+++ b/pf4j/src/test/resources/test-plugin-5/classes/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Implementation-Title: Test Plugin #2
+Implementation-Version: 0.10.0-SNAPSHOT
+Archiver-Version: Plexus Archiver
+Built-By: Mario Franco
+Specification-Title: Test Plugin #2
+Implementation-Vendor-Id: ro.fortsoft.pf4j.demo
+Plugin-Id: test-plugin-2
+Plugin-Provider: Decebal Suiu
+Plugin-Class: ro.fortsoft.pf4j.plugin.TestPlugin
+Created-By: Apache Maven 3.0.5
+Build-Jdk: 1.8.0_45
+Specification-Version: 0.10.0-SNAPSHOT
+