diff options
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryViewSorterTest.java')
-rw-r--r-- | org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryViewSorterTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryViewSorterTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryViewSorterTest.java new file mode 100644 index 000000000..b5eb46c96 --- /dev/null +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryViewSorterTest.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2013 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; + +import junit.framework.TestCase; + +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants; +import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesViewSorter; +import org.eclipse.mylyn.tasks.core.TaskRepository; + +public class TaskRepositoryViewSorterTest extends TestCase { + + public void testCategorySorting() { + ViewerSorter sorter = new TaskRepositoriesViewSorter(); + TaskRepository t1 = new TaskRepository("kind", "http://a"); + t1.setCategory(IRepositoryConstants.CATEGORY_OTHER); + TaskRepository t2 = new TaskRepository("kind", "http://b"); + t2.setCategory(IRepositoryConstants.CATEGORY_OTHER); + TaskRepository t3 = new TaskRepository("kind", "http://c"); + t3.setCategory(TaskRepository.CATEGORY_TASKS); + + assertTrue(sorter.compare(null, t1, t2) < 0); + assertTrue(sorter.compare(null, t2, t3) > 0); + assertTrue(sorter.compare(null, t3, t1) < 0); + } +} |