diff options
author | Steffen Pingel | 2012-02-12 12:22:01 +0000 |
---|---|---|
committer | Steffen Pingel | 2012-02-12 12:22:01 +0000 |
commit | 23afd2a8112c4fb5d77f961aa1814a57c1840f93 (patch) | |
tree | 81ac50bf7f46ca6df3429e07c5ae062bf9d3af5e /org.eclipse.mylyn.tasks.tests | |
parent | a73ad6d430c3fcbcfbd0ef75765f1d6397ddc46e (diff) | |
download | org.eclipse.mylyn.tasks-23afd2a8112c4fb5d77f961aa1814a57c1840f93.tar.gz org.eclipse.mylyn.tasks-23afd2a8112c4fb5d77f961aa1814a57c1840f93.tar.xz org.eclipse.mylyn.tasks-23afd2a8112c4fb5d77f961aa1814a57c1840f93.zip |
NEW - bug 371323: [regression] all comments are shown as incoming
https://bugs.eclipse.org/bugs/show_bug.cgi?id=371323
Change-Id: I20bd34a248dbfbd2e157ffdfda183aaa0fd30b00
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
2 files changed, 101 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 abc4bd7a7..fc10dc01d 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 @@ -19,6 +19,7 @@ import org.eclipse.mylyn.tasks.tests.core.ITasksCoreConstantsTest; import org.eclipse.mylyn.tasks.tests.core.PriorityLevelTest; import org.eclipse.mylyn.tasks.tests.core.TaskListUnmatchedContainerTest; import org.eclipse.mylyn.tasks.tests.core.TaskRepositoryLocationTest; +import org.eclipse.mylyn.tasks.tests.data.TaskAttributeMapperTest; import org.eclipse.mylyn.tasks.tests.data.TaskDataExternalizerTest; import org.eclipse.mylyn.tasks.tests.data.Xml11InputStreamTest; import org.eclipse.mylyn.tasks.tests.ui.MultipleTaskHyperlinkDetectorTest; @@ -120,6 +121,7 @@ public class AllTasksTests { suite.addTestSuite(MultipleTaskHyperlinkDetectorTest.class); suite.addTestSuite(RegionComparatorTest.class); suite.addTestSuite(PriorityLevelTest.class); + suite.addTestSuite(TaskAttributeMapperTest.class); return suite; } diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/TaskAttributeMapperTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/TaskAttributeMapperTest.java new file mode 100644 index 000000000..76b6a9304 --- /dev/null +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/TaskAttributeMapperTest.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * 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.data; + +import junit.framework.TestCase; + +import org.eclipse.mylyn.tasks.core.TaskRepository; +import org.eclipse.mylyn.tasks.core.data.TaskAttribute; +import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; +import org.eclipse.mylyn.tasks.core.data.TaskCommentMapper; +import org.eclipse.mylyn.tasks.core.data.TaskData; + +/** + * @author Steffen Pingel + */ +public class TaskAttributeMapperTest extends TestCase { + + TaskRepository taskRepository = new TaskRepository("kind", "repository"); + + TaskAttributeMapper mapper = new TaskAttributeMapper(taskRepository); + + TaskData data = new TaskData(mapper, "kind", "repository", "id"); + + public void testEqualsCommentId() { + TaskCommentMapper comment = new TaskCommentMapper(); + comment.setCommentId("commentid"); + comment.setNumber(1); + + TaskAttribute attributeOld = data.getRoot().createAttribute("1"); + comment.applyTo(attributeOld); + + TaskAttribute attributeNew = data.getRoot().createAttribute("2"); + comment.applyTo(attributeNew); + assertTrue(mapper.equals(attributeNew, attributeOld)); + + comment.setCommentId("commentid2"); + comment.applyTo(attributeOld); + assertFalse("Expected not equals:\n" + attributeOld + "\n" + attributeNew, + mapper.equals(attributeNew, attributeOld)); + } + + public void testEqualsCommentMylyn37() { + TaskCommentMapper comment = new TaskCommentMapper(); + comment.setNumber(1); + + // Mylyn 3.7 before release + TaskAttribute attributeOld = data.getRoot().createAttribute("1"); + comment.applyTo(attributeOld); + attributeOld.setValue("1"); + + // Mylyn 3.7 release + TaskAttribute attributeNew = data.getRoot().createAttribute("2"); + comment.applyTo(attributeNew); + assertEquals("", attributeNew.getValue()); + + assertTrue("Expected equals:\n" + attributeOld + "\n" + attributeNew, mapper.equals(attributeNew, attributeOld)); + assertFalse("Expected not equals:\n" + attributeOld + "\n" + attributeNew, + mapper.equals(attributeOld, attributeNew)); + } + + public void testEqualsCommentMylyn37CommentId() { + TaskCommentMapper comment = new TaskCommentMapper(); + comment.setNumber(1); + comment.setCommentId("2"); + + // Mylyn 3.7 before release, but missing sub-attribute + TaskAttribute attributeOld = data.getRoot().createAttribute("1"); + comment.applyTo(attributeOld); + attributeOld.setValue("1"); + + // Mylyn 3.7 release + TaskAttribute attributeNew = data.getRoot().createAttribute("2"); + comment.applyTo(attributeNew); + assertEquals("2", attributeNew.getValue()); + + assertFalse("Expected not equals:\n" + attributeOld + "\n" + attributeNew, + mapper.equals(attributeNew, attributeOld)); + + // Mylyn 3.7 before release with ID sub-attribute + TaskAttribute idAttribute = attributeOld.createAttribute("task.common.comment.id"); + idAttribute.setValue("2"); + assertTrue("Expected equals:\n" + attributeOld + "\n" + attributeNew, mapper.equals(attributeNew, attributeOld)); + + // IDs should now be unequal + idAttribute.setValue("3"); + assertFalse("Expected not equals:\n" + attributeOld + "\n" + attributeNew, + mapper.equals(attributeNew, attributeOld)); + } + +} |