summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Schmidt2012-08-08 22:31:09 (EDT)
committerSebastian Schmidt2012-08-08 22:31:09 (EDT)
commit1b8ef0ef83a71218cfeaad71910239ee7cf1f05a (patch)
tree7e065930e374684a8904138f6159387cdd4fe9a1
parentcd4780b72db3a26966e3fe5609fe0bdd01e6c1a3 (diff)
downloadorg.eclipse.mylyn.context-1b8ef0ef83a71218cfeaad71910239ee7cf1f05a.zip
org.eclipse.mylyn.context-1b8ef0ef83a71218cfeaad71910239ee7cf1f05a.tar.gz
org.eclipse.mylyn.context-1b8ef0ef83a71218cfeaad71910239ee7cf1f05a.tar.bz2
386548: fix failing ContextExternalizerTest.testAddContextContributor()refs/changes/50/7150/1
Bug: 386548 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=386548 Change-Id: I37ff0854133df5d28b373b3e8f9e08aff97feb79
-rw-r--r--org.eclipse.mylyn.context.tests/src/org/eclipse/mylyn/context/tests/ContextExternalizerTest.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.context.tests/src/org/eclipse/mylyn/context/tests/ContextExternalizerTest.java b/org.eclipse.mylyn.context.tests/src/org/eclipse/mylyn/context/tests/ContextExternalizerTest.java
index 3a48531..f3b013d 100644
--- a/org.eclipse.mylyn.context.tests/src/org/eclipse/mylyn/context/tests/ContextExternalizerTest.java
+++ b/org.eclipse.mylyn.context.tests/src/org/eclipse/mylyn/context/tests/ContextExternalizerTest.java
@@ -53,6 +53,8 @@ public class ContextExternalizerTest extends AbstractContextTest {
private File contextFile;
+ private AbstractContextContributor contributor;
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -67,6 +69,9 @@ public class ContextExternalizerTest extends AbstractContextTest {
contextFile.delete();
}
+ if (contributor != null) {
+ ContextCorePlugin.getDefault().removeContextContributor(contributor);
+ }
super.tearDown();
}
@@ -314,23 +319,24 @@ public class ContextExternalizerTest extends AbstractContextTest {
public void testAddContextContributor() throws Exception {
InteractionContextExternalizer externalizer = new InteractionContextExternalizer();
ContextCorePlugin contextCorePlugin = ContextCorePlugin.getDefault();
- AbstractContextContributor contributor = mock(AbstractContextContributor.class);
+ contributor = mock(AbstractContextContributor.class);
when(contributor.getDataAsStream(context)).thenReturn(null);
+ int initialContributor = contextCorePlugin.getContextContributor().size();
contextCorePlugin.addContextContributor(contributor);
- assertEquals(1, contextCorePlugin.getContextContributor().size());
- assertEquals(contributor, contextCorePlugin.getContextContributor().get(0));
+ assertEquals(initialContributor + 1, contextCorePlugin.getContextContributor().size());
+ assertEquals(contributor, contextCorePlugin.getContextContributor().get(initialContributor));
externalizer.writeContext(context, mock(ZipOutputStream.class));
verify(contributor).getDataAsStream(context);
contextCorePlugin.removeContextContributor(contributor);
- assertEquals(0, contextCorePlugin.getContextContributor().size());
+ assertEquals(initialContributor, contextCorePlugin.getContextContributor().size());
}
public void testWriteAdditionalContextData() throws Exception {
InteractionContextExternalizer externalizer = new InteractionContextExternalizer();
- AbstractContextContributor contributor = mock(AbstractContextContributor.class);
+ contributor = mock(AbstractContextContributor.class);
InteractionEvent event = mockNavigation("InteractionEvent");
context.parseEvent(event);