Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-12-02 19:48:22 -0500
committerspingel2009-12-02 19:48:22 -0500
commitd62a1663d02e030f0fd40a15545b50220fe6105e (patch)
tree0225006dbc462753dce69f21d0afbe1a30df26f8
parent7302d593dd2ec08ed45146958f3966339bc022ab (diff)
downloadorg.eclipse.mylyn.tasks-d62a1663d02e030f0fd40a15545b50220fe6105e.tar.gz
org.eclipse.mylyn.tasks-d62a1663d02e030f0fd40a15545b50220fe6105e.tar.xz
org.eclipse.mylyn.tasks-d62a1663d02e030f0fd40a15545b50220fe6105e.zip
RESOLVED - bug 296760: prepend bug prefix to text that is generated by copy details
https://bugs.eclipse.org/bugs/show_bug.cgi?id=296760
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java29
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java11
2 files changed, 35 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java
index 2de6d6af7..02dfc6ebb 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * Copyright (c) 2009 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,17 +14,36 @@ package org.eclipse.mylyn.tasks.tests;
import junit.framework.TestCase;
import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction;
+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
import org.eclipse.mylyn.tasks.tests.connector.MockTask;
/**
- * @author Mik Kersten
+ * @author Steffen Pingel
*/
public class CopyDetailsActionTest extends TestCase {
public void testIdLabelIncluded() {
- MockTask task = new MockTask("123");
- String text = CopyTaskDetailsAction.getTextForTask(task);
- assertTrue(text.startsWith(task.getTaskKey()));
+ MockRepositoryConnector connector = MockRepositoryConnector.getDefault();
+ String oldPrefix = connector.getTaskIdPrefix();
+ try {
+ MockTask task = new MockTask("123");
+ task.setSummary("abc");
+
+ connector.setTaskIdPrefix("task");
+ String text = CopyTaskDetailsAction.getTextForTask(task);
+ assertEquals("task 123: abc", text.substring(0, 13));
+
+ connector.setTaskIdPrefix("#");
+ assertEquals("#123: abc", CopyTaskDetailsAction.getTextForTask(task));
+
+ connector.setTaskIdPrefix("");
+ assertEquals("123: abc", CopyTaskDetailsAction.getTextForTask(task));
+
+ task.setTaskKey(null);
+ assertEquals("abc", CopyTaskDetailsAction.getTextForTask(task));
+ } finally {
+ connector.setTaskIdPrefix(oldPrefix);
+ }
}
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java
index 6e4e1f4e9..67c5dafe5 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/connector/MockRepositoryConnector.java
@@ -52,6 +52,8 @@ public class MockRepositoryConnector extends AbstractRepositoryConnector {
private boolean hasLocalCompletionState;
+ private String taskIdPrefix;
+
public MockRepositoryConnector() {
resetDefaults();
}
@@ -170,4 +172,13 @@ public class MockRepositoryConnector extends AbstractRepositoryConnector {
// return templates;
// }
+ @Override
+ public String getTaskIdPrefix() {
+ return taskIdPrefix;
+ }
+
+ public void setTaskIdPrefix(String taskIdPrefix) {
+ this.taskIdPrefix = taskIdPrefix;
+ }
+
}

Back to the top