Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Ehrnhoefer2011-07-16 01:41:33 +0000
committerSteffen Pingel2011-07-16 01:41:33 +0000
commit18dc0dbb3f95d58ca744a0f1c8f541bae168e62d (patch)
treed184872e34ca6e5bf0bc0d1e94883a8b0719f4c5 /org.eclipse.mylyn.tasks.tests/src
parent75678454416eba1a9fafc157d016336f3e10c2c4 (diff)
downloadorg.eclipse.mylyn.tasks-18dc0dbb3f95d58ca744a0f1c8f541bae168e62d.tar.gz
org.eclipse.mylyn.tasks-18dc0dbb3f95d58ca744a0f1c8f541bae168e62d.tar.xz
org.eclipse.mylyn.tasks-18dc0dbb3f95d58ca744a0f1c8f541bae168e62d.zip
NEW - bug 351120: [patch] include "pretty name" in person content assist
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351120
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests/src')
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java81
1 files changed, 81 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java
index 9f1e01262..7dba45e69 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/PersonProposalProviderTest.java
@@ -12,6 +12,11 @@
package org.eclipse.mylyn.tasks.tests;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+
import junit.framework.TestCase;
import org.eclipse.jface.fieldassist.IContentProposal;
@@ -203,4 +208,80 @@ public class PersonProposalProviderTest extends TestCase {
assertTrue(((PersonContentProposal) result[0]).isCurrentUser());
}
+ public void testGetProposalByPrettyName() throws Exception {
+ Map<String, String> users = new HashMap<String, String>();
+ users.put("11", "foo");
+ users.put("22", "bar");
+ users.put("33", "far");
+ users.put("21", "boo");
+ MockTask task1 = new MockTask(null, "1", null);
+ task1.setOwner("11");
+
+ PersonProposalProvider provider = new PersonProposalProvider(task1, (TaskData) null, users);
+ IContentProposal[] result = provider.getProposals("", 0);
+ Arrays.sort(result, new Comparator<IContentProposal>() {
+ public int compare(IContentProposal o1, IContentProposal o2) {
+ return o1.getContent().compareTo(o2.getContent());
+ }
+ });
+ assertNotNull(result);
+ assertEquals(4, result.length);
+ assertEquals("11", result[0].getContent());
+ assertEquals("21", result[1].getContent());
+ assertEquals("22", result[2].getContent());
+ assertEquals("33", result[3].getContent());
+
+ result = provider.getProposals("f", 1);
+ Arrays.sort(result, new Comparator<IContentProposal>() {
+ public int compare(IContentProposal o1, IContentProposal o2) {
+ return o1.getContent().compareTo(o2.getContent());
+ }
+ });
+ assertNotNull(result);
+ assertEquals(2, result.length);
+ assertEquals("11", result[0].getContent());
+ assertEquals("33", result[1].getContent());
+
+ result = provider.getProposals("b", 1);
+ Arrays.sort(result, new Comparator<IContentProposal>() {
+ public int compare(IContentProposal o1, IContentProposal o2) {
+ return o1.getContent().compareTo(o2.getContent());
+ }
+ });
+ assertNotNull(result);
+ assertEquals(2, result.length);
+ assertEquals("21", result[0].getContent());
+ assertEquals("22", result[1].getContent());
+
+ result = provider.getProposals("1", 1);
+ Arrays.sort(result, new Comparator<IContentProposal>() {
+ public int compare(IContentProposal o1, IContentProposal o2) {
+ return o1.getContent().compareTo(o2.getContent());
+ }
+ });
+ assertNotNull(result);
+ assertEquals(1, result.length);
+ assertEquals("11", result[0].getContent());
+
+ result = provider.getProposals("3", 1);
+ Arrays.sort(result, new Comparator<IContentProposal>() {
+ public int compare(IContentProposal o1, IContentProposal o2) {
+ return o1.getContent().compareTo(o2.getContent());
+ }
+ });
+ assertNotNull(result);
+ assertEquals(1, result.length);
+ assertEquals("33", result[0].getContent());
+
+ result = provider.getProposals("2", 1);
+ Arrays.sort(result, new Comparator<IContentProposal>() {
+ public int compare(IContentProposal o1, IContentProposal o2) {
+ return o1.getContent().compareTo(o2.getContent());
+ }
+ });
+ assertNotNull(result);
+ assertEquals(2, result.length);
+ assertEquals("21", result[0].getContent());
+ assertEquals("22", result[1].getContent());
+ }
}

Back to the top