changeset 119:07602eec599d

Make unit test run without the eclipse runtime
author Omair Majid <omajid@redhat.com>
date Fri, 14 Mar 2014 15:24:53 -0400
parents 96c81fcd180c
children 1c4f192bf2e2
files com.redhat.thermostat.tools.eclipse.plugin.tests/src/com/redhat/thermostat/tools/eclipse/plugin/tests/BundleFinderTest.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/BundleFinder.java
diffstat 2 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/com.redhat.thermostat.tools.eclipse.plugin.tests/src/com/redhat/thermostat/tools/eclipse/plugin/tests/BundleFinderTest.java	Wed Mar 05 16:16:25 2014 -0500
+++ b/com.redhat.thermostat.tools.eclipse.plugin.tests/src/com/redhat/thermostat/tools/eclipse/plugin/tests/BundleFinderTest.java	Fri Mar 14 15:24:53 2014 -0400
@@ -4,7 +4,6 @@
 import static org.junit.Assert.assertTrue;
 
 import java.util.Collection;
-import java.util.Collections;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -26,7 +25,7 @@
 
     @Test
     public void testNoArgumentVariantDoesNothing() {
-        BundleFinder finder = new BundleFinder(new IProject[0], progressMonitor);
+        BundleFinder finder = new BundleFinder(null, new IProject[0], progressMonitor);
         Collection<BundleInformation> result = finder.find();
         assertNotNull(result);
         assertTrue(result.isEmpty());
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/BundleFinder.java	Wed Mar 05 16:16:25 2014 -0500
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/BundleFinder.java	Fri Mar 14 15:24:53 2014 -0400
@@ -14,7 +14,6 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
@@ -37,12 +36,12 @@
     private IProject[] projects;
 
     public BundleFinder(IProject[] projects, IProgressMonitor progressMonitor) {
-        this.projects = projects;
-        initialize();
+        this(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(), projects, progressMonitor);
     }
 
-    private void initialize() {
-        workspaceRoot = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile();
+    public BundleFinder(File root, IProject[] projects, IProgressMonitor progressMonitor) {
+        this.projects = projects;
+        workspaceRoot = root;
     }
 
     public Collection<BundleInformation> find() {