diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2015-07-21 17:05:09 +0300 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2015-07-21 17:05:09 +0300 |
commit | c5a8022e5aea87c0ff613eb4c27ce8af795208fc (patch) | |
tree | 88fa5864d5577e01f251f700f419f3ac51b26b15 /pf4j | |
parent | d2f73728a2446d0f147c5d5cf1e06abb8cd355bd (diff) | |
download | pf4j-c5a8022e5aea87c0ff613eb4c27ce8af795208fc.tar.gz pf4j-c5a8022e5aea87c0ff613eb4c27ce8af795208fc.zip |
fix #60
Diffstat (limited to 'pf4j')
-rw-r--r-- | pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginRepositoryTest.java | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginRepositoryTest.java b/pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginRepositoryTest.java index b2ccbd0..0ea7cc2 100644 --- a/pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginRepositoryTest.java +++ b/pf4j/src/test/java/ro/fortsoft/pf4j/DefaultPluginRepositoryTest.java @@ -15,23 +15,21 @@ */ package ro.fortsoft.pf4j; -import java.io.File; -import java.io.IOException; -import java.util.List; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import ro.fortsoft.pf4j.util.ZipFileFilter; +import java.io.File; +import java.io.IOException; +import java.util.List; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; - /** - * * @author Mario Franco */ public class DefaultPluginRepositoryTest { @@ -51,14 +49,13 @@ public class DefaultPluginRepositoryTest { */ @Test public void testGetPluginArchives() { - DefaultPluginRepository instance = new DefaultPluginRepository(testFolder.getRoot(), new ZipFileFilter()); List<File> result = instance.getPluginArchives(); assertEquals(2, result.size()); - assertEquals(result.get(0).getName(), "plugin-1.zip"); - assertEquals(result.get(1).getName(), "plugin-2.zip"); + assertFileExists(result, "plugin-1.zip"); + assertFileExists(result, "plugin-2.zip"); } /** @@ -69,14 +66,25 @@ public class DefaultPluginRepositoryTest { DefaultPluginRepository instance = new DefaultPluginRepository(testFolder.getRoot(), new ZipFileFilter()); assertTrue(instance.deletePluginArchive("/plugin-1")); - assertFalse(instance.deletePluginArchive("/plugin-3")); List<File> result = instance.getPluginArchives(); assertEquals(1, result.size()); assertEquals(result.get(0).getName(), "plugin-2.zip"); + } + + public static void assertFileExists(List<File> files, String file) { + boolean found = false; + + for (File f : files) { + if (f.getName().equals(file)) { + found = true; + break; + } + } + assertTrue("The directory must contains the file " + file, found); } } |