Skip to content

Commit

Permalink
Added easymock for mocking objects
Browse files Browse the repository at this point in the history
EasyMock is already being used on the HaskellCorePluginTest, but we need
to gradully convert other tests to use it.

EclipseFP's developer SDK is getting quite large. There are at least two
Eclipse plugins already (antlr and easymock). Maybe we should package this as
a feature or something.

darcs-hash:20060510143547-49d33-e40b59ee1e1d1e1356b0d6800ed1ff103fb35b5b.gz
  • Loading branch information
thiagoarrais committed May 10, 2006
1 parent 7693409 commit dbe565a
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 231 deletions.
1 change: 1 addition & 0 deletions net.sf.eclipsefp.haskell.core.test/META-INF/MANIFEST.MF
Expand Up @@ -6,6 +6,7 @@ Bundle-Version: 0.10.0
Bundle-Vendor: eclipsefp.sourceforge.net
Bundle-Localization: plugin
Require-Bundle: org.junit,
org.easymock,
org.eclipse.jface.text,
org.eclipse.core.resources,
org.eclipse.core.runtime,
Expand Down
@@ -1,22 +1,33 @@
package net.sf.eclipsefp.haskell.core.test;

import net.sf.eclipsefp.haskell.core.HaskellCorePlugin;
import net.sf.eclipsefp.haskell.core.test.internal.doubles.MockWorkspace;
import net.sf.eclipsefp.haskell.core.test.internal.doubles.StubBundleContext;

import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Plugin;

import junit.framework.TestCase;
import static org.easymock.EasyMock.*;

public class HaskellCorePluginTest extends TestCase {

public void testRegistersResourceChangeListener() throws Exception {
//TODO use a mock library here
MockWorkspace workspace = new MockWorkspace();
IWorkspace workspace = createMock(IWorkspace.class);

workspace.addResourceChangeListener((IResourceChangeListener) anyObject(), anyInt());
expectLastCall().times(1);

expect(workspace.getRoot()).
andReturn(ResourcesPlugin.getWorkspace().getRoot());

replay(workspace);

Plugin corePlugin = new HaskellCorePlugin(workspace);
corePlugin.start(new StubBundleContext());

workspace.verify();
verify(workspace);
}

}

This file was deleted.

Expand Up @@ -3,7 +3,7 @@
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<stringAttribute key="bootstrap" value=""/>
<booleanAttribute key="useProduct" value="false"/>
<stringAttribute key="deselected_workspace_plugins" value="net.sf.eclipsefp.haskell.refactoring,net.sf.eclipsefp.haskell.haddock,net.sf.eclipsefp.common.doc,org.eclipse.update.scheduler,de.leiffrenzel.fp.haskell,org.eclipse.jdt,org.eclipse.jdt.core,org.eclipse.jdt.core.manipulation,org.eclipse.jdt.debug.ui,de.leiffrenzel.fp.haskell.doc.user,org.eclipse.jdt.debug,org.eclipse.jdt.junit.runtime,org.eclipse.jdt.doc.user,org.eclipse.jdt.junit,de.leiffrenzel.fp.haskell.ghccompiler,org.eclipse.jdt.ui,org.eclipse.update.configurator,org.eclipse.update.ui,org.eclipse.jdt.apt.ui,org.eclipse.jdt.apt.core,org.eclipse.update.core,org.eclipse.jdt.launching,net.sf.eclipsefp.haskell.hugs,org.eclipse.update.core.linux"/>
<stringAttribute key="deselected_workspace_plugins" value="net.sf.eclipsefp.haskell.refactoring,net.sf.eclipsefp.haskell.haddock,org.eclipse.update.scheduler,net.sf.eclipsefp.common.doc,de.leiffrenzel.fp.haskell,org.eclipse.jdt,org.eclipse.jdt.core,org.eclipse.jdt.core.manipulation,org.eclipse.jdt.debug.ui,de.leiffrenzel.fp.haskell.doc.user,org.eclipse.jdt.doc.user,de.leiffrenzel.fp.haskell.ghccompiler,org.eclipse.jdt.ui,org.eclipse.jdt.doc.isv,org.eclipse.jdt.junit4.runtime,org.eclipse.update.configurator,org.eclipse.update.ui,org.eclipse.jdt.apt.ui,org.eclipse.update.core,org.eclipse.jdt.apt.core,org.eclipse.jdt.source,org.eclipse.jdt.launching,net.sf.eclipsefp.haskell.hugs,org.eclipse.update.core.linux"/>
<booleanAttribute key="tracing" value="false"/>
<stringAttribute key="selected_target_plugins" value="com.ibm.icu,org.apache.ant,org.apache.lucene,org.eclipse.ant.core,org.eclipse.compare,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.filebuffers,org.eclipse.core.filesystem,org.eclipse.core.filesystem.linux.x86,org.eclipse.core.jobs,org.eclipse.core.resources,org.eclipse.core.resources.compatibility,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.core.variables,org.eclipse.debug.core,org.eclipse.debug.ui,org.eclipse.equinox.common,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.help.appserver,org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.jface,org.eclipse.jface.text,org.eclipse.ltk.core.refactoring,org.eclipse.ltk.ui.refactoring,org.eclipse.osgi,org.eclipse.search,org.eclipse.swt,org.eclipse.swt.gtk.linux.x86,org.eclipse.team.core,org.eclipse.team.ui,org.eclipse.text,org.eclipse.ui,org.eclipse.ui.cheatsheets,org.eclipse.ui.console,org.eclipse.ui.editors,org.eclipse.ui.forms,org.eclipse.ui.ide,org.eclipse.ui.navigator,org.eclipse.ui.navigator.resources,org.eclipse.ui.views,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.workbench,org.eclipse.ui.workbench.texteditor,org.eclipse.update.configurator,org.eclipse.update.core,org.eclipse.update.core.linux,org.eclipse.update.ui,org.junit"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
Expand All @@ -27,4 +27,5 @@
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="net.sf.eclipsefp.test"/>
<booleanAttribute key="askclear" value="false"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
</launchConfiguration>
7 changes: 7 additions & 0 deletions org.easymock/.classpath
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" sourcepath="/tmp/easymock2.2/src.zip" kind="lib" path="lib/easymock.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path=""/>
</classpath>
28 changes: 28 additions & 0 deletions org.easymock/.project
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.easymock</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
9 changes: 9 additions & 0 deletions org.easymock/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Easymock
Bundle-SymbolicName: org.easymock
Bundle-Version: 2.2
Bundle-Vendor: eclipsefp.sourceforge.net
Bundle-Localization: plugin
Bundle-ClassPath: lib/easymock.jar
Export-Package: org.easymock
6 changes: 6 additions & 0 deletions org.easymock/build.properties
@@ -0,0 +1,6 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
lib/,\
lib/easymock.jar
src.includes = lib/
Binary file added org.easymock/lib/easymock.jar
Binary file not shown.

0 comments on commit dbe565a

Please sign in to comment.