Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2015-11-18 18:59:26 -0500
committerRyan D. Brooks2015-11-18 18:59:26 -0500
commit2cf5247c6ab389af34536e112978d9712cbd9a1f (patch)
tree81c9014e077a8b79a2ff45097c86b9eb3d42e94b /plugins/org.eclipse.osee.ats.core.test
parent2ae629d4ed6dfb7705fecef4375da1656f71c807 (diff)
downloadorg.eclipse.osee-2cf5247c6ab389af34536e112978d9712cbd9a1f.tar.gz
org.eclipse.osee-2cf5247c6ab389af34536e112978d9712cbd9a1f.tar.xz
org.eclipse.osee-2cf5247c6ab389af34536e112978d9712cbd9a1f.zip
feature[ats_ATS221006]: Remove UserSearchWorkflowSearchItem
Diffstat (limited to 'plugins/org.eclipse.osee.ats.core.test')
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/AtsCore_Util_JT_Suite.java6
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/VisitedItemCacheTest.java61
2 files changed, 66 insertions, 1 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/AtsCore_Util_JT_Suite.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/AtsCore_Util_JT_Suite.java
index 6163e72348..7a0db5a773 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/AtsCore_Util_JT_Suite.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/AtsCore_Util_JT_Suite.java
@@ -14,7 +14,11 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses({AtsObjectsTest.class, AtsUserGroupTest.class, HoursSpentUtilTest.class})
+@Suite.SuiteClasses({
+ VisitedItemCacheTest.class,
+ AtsObjectsTest.class,
+ AtsUserGroupTest.class,
+ HoursSpentUtilTest.class})
/**
* This test suite contains tests that can be run as stand-alone JUnit tests (JT)
*
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/VisitedItemCacheTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/VisitedItemCacheTest.java
new file mode 100644
index 0000000000..42c4d7c1e7
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/VisitedItemCacheTest.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.core.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.Iterator;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class VisitedItemCacheTest {
+
+ // @formatter:off
+ @Mock private IAtsWorkItem workItem1, workItem2, workItem3;
+ // @formatter:on
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ when(workItem1.getUuid()).thenReturn(12L);
+ when(workItem2.getUuid()).thenReturn(13L);
+ when(workItem3.getUuid()).thenReturn(14L);
+ }
+
+ @Test
+ public void test() {
+ VisitedItemCache cache = new VisitedItemCache();
+ assertEquals(0, cache.visitedUuids.size());
+
+ cache.addVisited(workItem1);
+ assertEquals(1, cache.getReverseVisited().size());
+ assertEquals(workItem1.getUuid(), cache.getReverseVisited().iterator().next().getUuid());
+
+ cache.addVisited(workItem2);
+ cache.addVisited(workItem3);
+ assertEquals(3, cache.getReverseVisited().size());
+ Iterator<IAtsWorkItem> iterator = cache.getReverseVisited().iterator();
+ assertEquals(workItem3.getUuid(), iterator.next().getUuid());
+ assertEquals(workItem2.getUuid(), iterator.next().getUuid());
+ assertEquals(workItem1.getUuid(), iterator.next().getUuid());
+
+ cache.clearVisited();
+ assertEquals(0, cache.getReverseVisited().size());
+
+ }
+
+}

Back to the top