Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVaughan Hilts2015-11-10 04:38:41 +0000
committerGerrit Code Review @ Eclipse.org2015-11-26 02:02:47 +0000
commitf653f7f0ce4a5fb7b84c0e99fa9634ef28bbc260 (patch)
tree1fcd6c65d268453f071947fb6f0081980c968470 /org.eclipse.mylyn.tasks.ui.tests
parent87ae1b0d5411a18b8c69f41fe992bbaaa114860b (diff)
downloadorg.eclipse.mylyn.tasks-f653f7f0ce4a5fb7b84c0e99fa9634ef28bbc260.tar.gz
org.eclipse.mylyn.tasks-f653f7f0ce4a5fb7b84c0e99fa9634ef28bbc260.tar.xz
org.eclipse.mylyn.tasks-f653f7f0ce4a5fb7b84c0e99fa9634ef28bbc260.zip
481168: [UCOSP] Add task list filter for review artifacts
Change-Id: I19f370a52cdf83ce800fea8d621c6db9d9b5abff Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=481168 Signed-off-by: Vaughan Hilts <hilts.vaughan@gmail.com>
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui.tests')
-rw-r--r--org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/internal/tasks/ui/ArtifactFilterTest.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/internal/tasks/ui/ArtifactFilterTest.java b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/internal/tasks/ui/ArtifactFilterTest.java
new file mode 100644
index 000000000..fd8be1ef9
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/internal/tasks/ui/ArtifactFilterTest.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Vaughan Hilts 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:
+ * Vaughan Hilts - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.ui;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.junit.Test;
+
+/**
+ * @author Vaughan Hilts
+ */
+@SuppressWarnings("restriction")
+public class ArtifactFilterTest {
+
+ @Test
+ public void testReviewArtifactIsFiltered() {
+ ITask task = mock(ITask.class);
+ when(task.getAttribute(ITasksCoreConstants.ATTRIBUTE_ARTIFACT)).thenReturn("true");
+ TaskReviewArtifactFilter filter = new TaskReviewArtifactFilter();
+
+ boolean wasFiltered = !filter.select(null, task);
+ assertTrue(wasFiltered);
+ }
+
+ @Test
+ public void testNonReviewArtifactIsntFiltered() {
+ ITask task = mock(ITask.class);
+ when(task.getAttribute(ITasksCoreConstants.ATTRIBUTE_ARTIFACT)).thenReturn("false");
+ TaskReviewArtifactFilter filter = new TaskReviewArtifactFilter();
+
+ boolean wasFiltered = !filter.select(null, task);
+ assertFalse(wasFiltered);
+ }
+
+ @Test
+ public void testUnclassifiedReviewArtifactIsntFiltered() {
+ // If a task is yet to be determined, we should not filter it
+ ITask task = mock(ITask.class);
+ TaskReviewArtifactFilter filter = new TaskReviewArtifactFilter();
+
+ boolean wasFiltered = !filter.select(null, task);
+ assertFalse(wasFiltered);
+ }
+
+ @Test
+ public void testArbitaryElementsAreNotFiltered() {
+ Object element = new Object();
+
+ TaskReviewArtifactFilter filter = new TaskReviewArtifactFilter();
+ boolean wasFiltered = !filter.select(null, element);
+ assertFalse(wasFiltered);
+ }
+
+}

Back to the top