diff options
author | Benjamin Muskalla | 2012-11-16 11:53:13 +0000 |
---|---|---|
committer | Steffen Pingel | 2013-07-04 21:09:42 +0000 |
commit | 4de53483f9cbdc8556101045d7dfa4d3402caf54 (patch) | |
tree | 0fc91a8cb9d991ef94293eba56619ec278cba32e /org.eclipse.mylyn.tasks.tests | |
parent | f82af84a906206b9f3cdbf92132bf0db1f4832f9 (diff) | |
download | org.eclipse.mylyn.tasks-4de53483f9cbdc8556101045d7dfa4d3402caf54.tar.gz org.eclipse.mylyn.tasks-4de53483f9cbdc8556101045d7dfa4d3402caf54.tar.xz org.eclipse.mylyn.tasks-4de53483f9cbdc8556101045d7dfa4d3402caf54.zip |
386764: [api] TaskMapping should be able to handle custom attributes
Added new API called TaskInitializationData to provide common mutators
for ITaskMapping to be used for task data initialization.
Also-By: Steffen Pingel <steffen.pingel@tasktop.com>
Change-Id: I13c88b5e33a8ab097953833627383ae85cfa692f
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=386764
Signed-off-by: Benjamin Muskalla <benjamin.muskalla@tasktop.com>
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
2 files changed, 128 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java index f1180231e..1cc3127ca 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java @@ -21,6 +21,7 @@ import org.eclipse.mylyn.tasks.tests.core.PriorityLevelTest; import org.eclipse.mylyn.tasks.tests.core.RepositoryClientManagerTest; import org.eclipse.mylyn.tasks.tests.core.RepositoryConnectorContributorTest; import org.eclipse.mylyn.tasks.tests.core.SynchronizeTasksJobTest; +import org.eclipse.mylyn.tasks.tests.core.TaskInitializationDataTest; import org.eclipse.mylyn.tasks.tests.core.TaskListUnmatchedContainerTest; import org.eclipse.mylyn.tasks.tests.core.TaskRepositoryLocationTest; import org.eclipse.mylyn.tasks.tests.core.TaskRepositoryTest; @@ -141,6 +142,7 @@ public class AllTasksTests { suite.addTestSuite(TaskAttributeTest.class); suite.addTestSuite(ScheduledTaskContainerTest.class); suite.addTestSuite(RepositoryConnectorContributorTest.class); + suite.addTestSuite(TaskInitializationDataTest.class); return suite; } diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskInitializationDataTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskInitializationDataTest.java new file mode 100644 index 000000000..3da37a270 --- /dev/null +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskInitializationDataTest.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2012 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.tasks.tests.core; + +import junit.framework.TestCase; + +import org.eclipse.mylyn.tasks.core.TaskInitializationData; +import org.eclipse.mylyn.tasks.core.data.TaskAttribute; + +/** + * @author Benjamin Muskalla + */ +public class TaskInitializationDataTest extends TestCase { + + private TaskInitializationData data; + + @Override + protected void setUp() throws Exception { + data = new TaskInitializationData(); + } + + public void testNotSupported() { + try { + data.merge(null); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + try { + data.getTaskStatus(); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + try { + data.getTaskData(); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + try { + data.getPriorityLevel(); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + try { + data.getModificationDate(); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + try { + data.getKeywords(); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + try { + data.getDueDate(); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + try { + data.getCreationDate(); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + try { + data.getCompletionDate(); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + try { + data.getCc(); + fail("Should not be supported"); + } catch (UnsupportedOperationException e) { + // expected + } + } + + public void testTaskKind() throws Exception { + data.setTaskKind("foo"); + assertEquals("foo", data.getTaskKind()); + assertEquals("foo", data.getAttribute(TaskAttribute.TASK_KIND)); + } + + public void testProduct() throws Exception { + data.setProduct("product"); + assertEquals("product", data.getProduct()); + assertEquals("product", data.getAttribute(TaskAttribute.PRODUCT)); + } + + public void testComponent() throws Exception { + data.setComponent("component"); + assertEquals("component", data.getComponent()); + assertEquals("component", data.getAttribute(TaskAttribute.COMPONENT)); + } + + public void testSetAttributeComponent() throws Exception { + data.setAttribute(TaskAttribute.COMPONENT, "component"); + assertEquals("component", data.getComponent()); + assertEquals("component", data.getAttribute(TaskAttribute.COMPONENT)); + } + + public void testGetAttribute() throws Exception { + assertNull(data.getAttribute("custom")); + data.setAttribute("custom", "value"); + assertEquals("value", data.getAttribute("custom")); + data.setAttribute("custom", null); + assertNull(data.getAttribute("custom")); + } + +} |