Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-03-23 18:49:48 -0400
committerRyan D. Brooks2016-03-23 18:49:48 -0400
commit2e6c04546ca281f48ec0dc518cfa5515db3e0954 (patch)
treed1c032315637028a196df58c70a429f836aaa154 /plugins/org.eclipse.osee.ats.core.test
parentb7dae5574ff3a46c34f2382af127982772daf1c0 (diff)
downloadorg.eclipse.osee-2e6c04546ca281f48ec0dc518cfa5515db3e0954.tar.gz
org.eclipse.osee-2e6c04546ca281f48ec0dc518cfa5515db3e0954.tar.xz
org.eclipse.osee-2e6c04546ca281f48ec0dc518cfa5515db3e0954.zip
feature[ats_ATS266887]: Add ImplementersColumn to IAtsColumn
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/column/AssigneeColumnTest.java63
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/ImplementersColumnTest.java138
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java16
3 files changed, 116 insertions, 101 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/AssigneeColumnTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/AssigneeColumnTest.java
index 7ea6e60523..ce480f1360 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/AssigneeColumnTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/AssigneeColumnTest.java
@@ -14,9 +14,10 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.eclipse.osee.ats.api.IAtsObject;
+import org.eclipse.osee.ats.api.IAtsServices;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.ats.api.user.IAtsUserService;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workflow.state.IAtsStateManager;
import org.eclipse.osee.ats.core.AbstractUserTest;
@@ -40,27 +41,26 @@ public class AssigneeColumnTest extends AbstractUserTest {
@Mock private IAtsWorkItem workItem2;
@Mock private IAtsStateManager stateMgr2;
@Mock private AtsActionGroup group;
+ @Mock private IAtsServices services;
+ @Mock private IAtsUserService userService;
// @formatter:on
- private AssigneeColumn column;
- private ImplementersColumn implementersColumn;
+ AssigneeColumn assigneeColumn;
@Override
@Before
public void setup() {
super.setup();
-
when(workItem.getStateMgr()).thenReturn(stateMgr);
when(workItem2.getStateMgr()).thenReturn(stateMgr2);
-
- implementersColumn = new ImplementersColumn();
- column = new AssigneeColumn(implementersColumn);
+ when(services.getUserService()).thenReturn(userService);
+ assigneeColumn = new AssigneeColumn(services);
}
@org.junit.Test
public void testGetAssigneeStr_null() throws OseeCoreException {
- Assert.assertEquals("", AssigneeColumn.instance.getAssigneeStr(null));
+ Assert.assertEquals("", assigneeColumn.getAssigneeStr(null));
}
@org.junit.Test
@@ -70,7 +70,7 @@ public class AssigneeColumnTest extends AbstractUserTest {
when(stateMgr.getStateType()).thenReturn(StateType.Working);
when(workItem.getAssignees()).thenReturn(assigneesToReturn);
- Assert.assertEquals("joe; steve; alice", AssigneeColumn.instance.getAssigneeStr(workItem));
+ Assert.assertEquals("joe; steve; alice", assigneeColumn.getAssigneeStr(workItem));
}
@org.junit.Test
@@ -78,14 +78,14 @@ public class AssigneeColumnTest extends AbstractUserTest {
List<IAtsUser> assigneesToReturn = new ArrayList<>();
when(stateMgr.getStateType()).thenReturn(StateType.Working);
when(workItem.getAssignees()).thenReturn(assigneesToReturn);
- Assert.assertEquals("", AssigneeColumn.instance.getAssigneeStr(workItem));
+ Assert.assertEquals("", assigneeColumn.getAssigneeStr(workItem));
List<IAtsUser> implementersToReturn = new ArrayList<>();
when(workItem.getImplementers()).thenReturn(implementersToReturn);
when(stateMgr.getStateType()).thenReturn(StateType.Completed);
when(workItem.getCompletedBy()).thenReturn(steve);
- Assert.assertEquals("(steve)", column.getAssigneeStr(workItem));
- Assert.assertTrue(column.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertEquals("(steve)", assigneeColumn.getAssigneeStr(workItem));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
// add alice as completedFromState assignee
implementersToReturn.add(steve);
@@ -93,13 +93,13 @@ public class AssigneeColumnTest extends AbstractUserTest {
List<IAtsUser> implementStateImplementers = new ArrayList<>();
implementStateImplementers.add(alice);
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("alice"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
// add duplicate steve as state assigne and ensure doesn't duplicate in string
implementStateImplementers.add(steve);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("alice"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
}
@org.junit.Test
@@ -107,13 +107,13 @@ public class AssigneeColumnTest extends AbstractUserTest {
List<IAtsUser> assigneesToReturn = new ArrayList<>();
when(stateMgr.getStateType()).thenReturn(StateType.Working);
when(workItem.getAssignees()).thenReturn(assigneesToReturn);
- Assert.assertEquals("", AssigneeColumn.instance.getAssigneeStr(workItem));
+ Assert.assertEquals("", assigneeColumn.getAssigneeStr(workItem));
List<IAtsUser> implementersToReturn = new ArrayList<>();
when(workItem.getImplementers()).thenReturn(implementersToReturn);
when(stateMgr.getStateType()).thenReturn(StateType.Cancelled);
when(workItem.getCancelledBy()).thenReturn(steve);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
// add alice as completedFromState assignee
implementersToReturn.add(steve);
@@ -121,13 +121,13 @@ public class AssigneeColumnTest extends AbstractUserTest {
List<IAtsUser> implementStateImplementers = new ArrayList<>();
implementStateImplementers.add(alice);
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("alice"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
// add duplicate steve as state assigne and ensure doesn't duplicate in string
implementStateImplementers.add(steve);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("alice"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
}
@org.junit.Test
@@ -147,7 +147,7 @@ public class AssigneeColumnTest extends AbstractUserTest {
group.addAction(workItem);
group.addAction(workItem2);
- Assert.assertEquals("(joe)", AssigneeColumn.instance.getAssigneeStr(group));
+ Assert.assertEquals("(joe)", assigneeColumn.getAssigneeStr(group));
}
@org.junit.Test
@@ -159,7 +159,7 @@ public class AssigneeColumnTest extends AbstractUserTest {
when(workItem2.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem2.getImplementers()).thenReturn(Arrays.asList(joe));
- Assert.assertEquals("(joe)", AssigneeColumn.instance.getAssigneeStr(group));
+ Assert.assertEquals("(joe)", assigneeColumn.getAssigneeStr(group));
}
@org.junit.Test
@@ -171,8 +171,8 @@ public class AssigneeColumnTest extends AbstractUserTest {
when(workItem2.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem2.getImplementers()).thenReturn(Arrays.asList(joe));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(group).contains("joe"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(group).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(group).contains("joe"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(group).contains("steve"));
}
@org.junit.Test
@@ -192,19 +192,12 @@ public class AssigneeColumnTest extends AbstractUserTest {
group.addAction(workItem);
group.addAction(workItem2);
- Assert.assertEquals("steve", AssigneeColumn.instance.getAssigneeStr(group));
+ Assert.assertEquals("steve", assigneeColumn.getAssigneeStr(group));
}
@org.junit.Test
public void testGetAssigneesStr_invalidImplementersString() throws OseeCoreException {
- AssigneeColumn column = new AssigneeColumn(new ImplementersStringProvider() {
-
- @Override
- public String getImplementersStr(IAtsObject atsObject) {
- return null;
- }
- });
-
+ AssigneeColumn column = new AssigneeColumn((IAtsServices) null);
when(stateMgr.getStateType()).thenReturn(StateType.Cancelled);
Assert.assertEquals("", column.getAssigneeStr(workItem));
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/ImplementersColumnTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/ImplementersColumnTest.java
index b3c9a2e83e..15d85c8868 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/ImplementersColumnTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/ImplementersColumnTest.java
@@ -14,14 +14,17 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.eclipse.osee.ats.api.IAtsServices;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.user.IAtsUser;
+import org.eclipse.osee.ats.api.user.IAtsUserService;
+import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
import org.eclipse.osee.ats.api.workdef.StateType;
import org.eclipse.osee.ats.api.workflow.state.IAtsStateManager;
import org.eclipse.osee.ats.core.AbstractUserTest;
-import org.eclipse.osee.ats.core.mock.MockWorkItem;
import org.eclipse.osee.ats.core.model.impl.AtsActionGroup;
import org.eclipse.osee.ats.core.users.AtsCoreUsers;
+import org.eclipse.osee.ats.core.workflow.AtsImplementersService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.junit.Assert;
import org.junit.Before;
@@ -39,26 +42,30 @@ public class ImplementersColumnTest extends AbstractUserTest {
@Mock private IAtsWorkItem workItem2;
@Mock private IAtsStateManager stateMgr2;
@Mock private AtsActionGroup group;
+ @Mock private IAtsServices services;
+ @Mock private IAtsUserService userService;
+ @Mock private IAttributeResolver attributeResolver;
// @formatter:on
+ AtsImplementersService impService;
+ AssigneeColumn assigneeColumn;
+
@Override
@Before
public void setup() {
super.setup();
-
+ when(services.getUserService()).thenReturn(userService);
when(workItem.getStateMgr()).thenReturn(stateMgr);
-
when(workItem2.getStateMgr()).thenReturn(stateMgr2);
- }
+ when(services.getUserService()).thenReturn(userService);
+ when(services.getAttributeResolver()).thenReturn(attributeResolver);
- @org.junit.Test
- public void testConstructor() {
- new ImplementersColumn();
+ impService = new AtsImplementersService(services);
+ assigneeColumn = new AssigneeColumn(services);
}
- @org.junit.Test
public void testGetImplementersStrFromInWorkWorkflow_null() throws OseeCoreException {
- Assert.assertEquals("", ImplementersColumn.instance.getImplementersStr(null));
+ Assert.assertEquals("", impService.getImplementersStr(null));
}
/**
@@ -67,7 +74,7 @@ public class ImplementersColumnTest extends AbstractUserTest {
@org.junit.Test
public void testGetImplementersStrFromInWorkWorkflow_workItem() throws OseeCoreException {
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Working);
- Assert.assertEquals("", ImplementersColumn.instance.getImplementersStr(workItem));
+ Assert.assertEquals("", impService.getImplementersStr(workItem));
}
/**
@@ -79,7 +86,7 @@ public class ImplementersColumnTest extends AbstractUserTest {
assigneesToReturn.addAll(Arrays.asList(steve, alice));
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Working);
when(workItem.getAssignees()).thenReturn(assigneesToReturn);
- Assert.assertEquals("", ImplementersColumn.instance.getImplementersStr(workItem));
+ Assert.assertEquals("", impService.getImplementersStr(workItem));
}
/**
@@ -88,10 +95,10 @@ public class ImplementersColumnTest extends AbstractUserTest {
@org.junit.Test
public void testGetImplementersStrFromCompletedCancelledWorkflow_blankIfNothingToShow() throws OseeCoreException {
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Completed);
- Assert.assertEquals("", ImplementersColumn.instance.getImplementersStr(workItem));
+ Assert.assertEquals("", impService.getImplementersStr(workItem));
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
- Assert.assertEquals("", ImplementersColumn.instance.getImplementersStr(workItem));
+ Assert.assertEquals("", impService.getImplementersStr(workItem));
}
/**
@@ -101,11 +108,11 @@ public class ImplementersColumnTest extends AbstractUserTest {
public void testGetImplementersStrFromCompletedCancelledWorkflow_completedBySet() throws OseeCoreException {
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Completed);
when(workItem.getCompletedBy()).thenReturn(steve);
- Assert.assertEquals("steve", ImplementersColumn.instance.getImplementersStr(workItem));
+ Assert.assertEquals("steve", impService.getImplementersStr(workItem));
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem.getCancelledBy()).thenReturn(steve);
- Assert.assertEquals("steve", ImplementersColumn.instance.getImplementersStr(workItem));
+ Assert.assertEquals("steve", impService.getImplementersStr(workItem));
}
@@ -121,42 +128,46 @@ public class ImplementersColumnTest extends AbstractUserTest {
when(workItem.getCompletedBy()).thenReturn(steve);
when(workItem.getCompletedFromState()).thenReturn("Implement");
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("alice"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem.getCancelledBy()).thenReturn(steve);
when(workItem.getCancelledFromState()).thenReturn("Implement");
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("alice"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
}
/**
- * Test one CompletedBy and assignees from completedFromState with unassigned
+ * Test one CompletedBy (steve) and assignees (alice, unassigned) from completedFromState
*/
@org.junit.Test
public void testGetImplementersStrFromCompletedCancelledWorkflow_completedByAndAssigneeWithUnassigned() throws OseeCoreException {
- List<IAtsUser> implementersToReturn = new ArrayList<>();
- implementersToReturn.add(alice);
+ when(workItem.isCompleted()).thenReturn(true);
+ when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Completed);
+
+ // Add alice and unassigned as Implement assignees
List<IAtsUser> implementStateImplementers = new ArrayList<>();
+ implementStateImplementers.add(alice);
implementStateImplementers.add(AtsCoreUsers.UNASSIGNED_USER);
+ when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- when(workItem.getImplementers()).thenReturn(implementersToReturn);
- when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Completed);
+ // Add steve as completed by
when(workItem.getCompletedBy()).thenReturn(steve);
when(workItem.getCompletedFromState()).thenReturn("Implement");
- when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ String assigneeStr = assigneeColumn.getAssigneeStr(workItem);
+
+ Assert.assertTrue(assigneeStr.contains("alice"));
+ Assert.assertTrue(assigneeStr.contains("steve"));
- when(workItem.getImplementers()).thenReturn(implementersToReturn);
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem.getCancelledBy()).thenReturn(steve);
when(workItem.getCancelledFromState()).thenReturn("Implement");
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ assigneeStr = assigneeColumn.getAssigneeStr(workItem);
+ Assert.assertTrue(assigneeStr.contains("alice"));
+ Assert.assertTrue(assigneeStr.contains("steve"));
}
/**
@@ -172,48 +183,54 @@ public class ImplementersColumnTest extends AbstractUserTest {
when(workItem.getCompletedBy()).thenReturn(steve);
when(workItem.getCompletedFromState()).thenReturn("Implement");
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("alice"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem.getCancelledBy()).thenReturn(steve);
when(workItem.getCancelledFromState()).thenReturn("Implement");
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("alice"));
- Assert.assertTrue(AssigneeColumn.instance.getAssigneeStr(workItem).contains("steve"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("alice"));
+ Assert.assertTrue(assigneeColumn.getAssigneeStr(workItem).contains("steve"));
}
/**
- * Test one CompletedBy and assignees from completedFromState and workItem.getImplementers()
+ * Test one CompletedBy and assignees from completedFromState
*/
@org.junit.Test
public void testGetImplementersStrFromCompletedCancelledWorkflow_fromAll() throws OseeCoreException {
- List<IAtsUser> implementersToReturn = new ArrayList<>();
- when(workItem.getImplementers()).thenReturn(implementersToReturn);
+ // completed by is steve
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Completed);
when(workItem.getCompletedBy()).thenReturn(steve);
- implementersToReturn.add(joe);
- when(workItem.getCompletedFromState()).thenReturn("Implement");
+
+ // "completed from state" had assignees alice and joe
List<IAtsUser> implementStateImplementers = new ArrayList<>();
implementStateImplementers.add(alice);
+ implementStateImplementers.add(joe);
+ when(workItem.getCompletedFromState()).thenReturn("Implement");
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(ImplementersColumn.instance.getImplementersStr(workItem).contains("alice"));
- Assert.assertTrue(ImplementersColumn.instance.getImplementersStr(workItem).contains("joe"));
- Assert.assertTrue(ImplementersColumn.instance.getImplementersStr(workItem).contains("steve"));
- implementersToReturn = new ArrayList<>();
- when(workItem.getImplementers()).thenReturn(implementersToReturn);
+ String implementersStr = impService.getImplementersStr(workItem);
+ Assert.assertTrue(implementersStr.contains("alice"));
+ Assert.assertTrue(implementersStr.contains("joe"));
+ Assert.assertTrue(implementersStr.contains("steve"));
+
+ // cancelled by is steve
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem.getCancelledBy()).thenReturn(steve);
- implementersToReturn.add(joe);
+
+ // "completed from state" has assignees joe and alice
when(workItem.getCancelledFromState()).thenReturn("Implement");
implementStateImplementers = new ArrayList<>();
implementStateImplementers.add(alice);
+ implementStateImplementers.add(joe);
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertTrue(ImplementersColumn.instance.getImplementersStr(workItem).contains("alice"));
- Assert.assertTrue(ImplementersColumn.instance.getImplementersStr(workItem).contains("joe"));
- Assert.assertTrue(ImplementersColumn.instance.getImplementersStr(workItem).contains("steve"));
+
+ implementersStr = impService.getImplementersStr(workItem);
+ Assert.assertTrue(implementersStr.contains("alice"));
+ Assert.assertTrue(implementersStr.contains("joe"));
+ Assert.assertTrue(implementersStr.contains("steve"));
}
@@ -229,14 +246,14 @@ public class ImplementersColumnTest extends AbstractUserTest {
when(workItem.getCompletedBy()).thenReturn(alice);
when(workItem.getCompletedFromState()).thenReturn("Implement");
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertEquals("alice", ImplementersColumn.instance.getImplementersStr(workItem));
+ Assert.assertEquals("alice", impService.getImplementersStr(workItem));
when(workItem.getImplementers()).thenReturn(implementersToReturn);
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem.getCancelledBy()).thenReturn(alice);
when(workItem.getCancelledFromState()).thenReturn("Implement");
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
- Assert.assertEquals("alice", ImplementersColumn.instance.getImplementersStr(workItem));
+ Assert.assertEquals("alice", impService.getImplementersStr(workItem));
}
@org.junit.Test
@@ -249,7 +266,7 @@ public class ImplementersColumnTest extends AbstractUserTest {
when(workItem.getCompletedBy()).thenReturn(alice);
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
List<IAtsUser> implementers = new ArrayList<>();
- ImplementersColumn.instance.getImplementers_fromCompletedCancelledBy(workItem, implementers);
+ impService.getImplementers_fromCompletedCancelledBy(workItem, implementers);
Assert.assertEquals(implementers.iterator().next(), alice);
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
@@ -258,19 +275,8 @@ public class ImplementersColumnTest extends AbstractUserTest {
when(workItem.getCancelledFromState()).thenReturn("Implement");
when(stateMgr.getAssigneesForState("Implement")).thenReturn(implementStateImplementers);
implementers = new ArrayList<>();
- ImplementersColumn.instance.getImplementers_fromCompletedCancelledBy(workItem, implementers);
- Assert.assertEquals(implementers.iterator().next(), alice);
- }
-
- @org.junit.Test
- public void testGetImplementers_fromWorkItem_noDuplicates() throws OseeCoreException {
- MockWorkItem workItem = new MockWorkItem("this", "Completed", StateType.Completed);
- List<IAtsUser> implementers = new ArrayList<>();
- implementers.add(alice);
- workItem.addImplementer(alice);
- ImplementersColumn.instance.getImplementers_fromWorkItem(workItem, implementers);
+ impService.getImplementers_fromCompletedCancelledBy(workItem, implementers);
Assert.assertEquals(implementers.iterator().next(), alice);
-
}
@org.junit.Test
@@ -282,12 +288,12 @@ public class ImplementersColumnTest extends AbstractUserTest {
when(workItem2.getStateMgr().getStateType()).thenReturn(StateType.Working);
when(workItem2.getCancelledBy()).thenReturn(steve);
- Assert.assertEquals("", ImplementersColumn.instance.getImplementersStr(group));
+ Assert.assertEquals("", impService.getImplementersStr(group));
when(workItem.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem2.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
- Assert.assertEquals("alice; steve", ImplementersColumn.instance.getImplementersStr(group));
+ Assert.assertEquals("alice; steve", impService.getImplementersStr(group));
}
@org.junit.Test
@@ -299,7 +305,7 @@ public class ImplementersColumnTest extends AbstractUserTest {
when(workItem2.getStateMgr().getStateType()).thenReturn(StateType.Cancelled);
when(workItem2.getCancelledBy()).thenReturn(steve);
- List<IAtsUser> implementers = ImplementersColumn.instance.getActionGroupImplementers(group);
+ List<IAtsUser> implementers = impService.getActionGroupImplementers(group);
Assert.assertEquals(1, implementers.size());
Assert.assertEquals(steve, implementers.iterator().next());
}
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java
index 6bc54fe23e..b9e503b0d8 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/mock/MockWorkItem.java
@@ -26,6 +26,7 @@ import org.eclipse.osee.ats.core.internal.log.AtsLogFactory;
import org.eclipse.osee.ats.core.internal.state.StateManager;
import org.eclipse.osee.ats.core.util.AtsUserGroup;
import org.eclipse.osee.framework.core.data.ArtifactId;
+import org.eclipse.osee.framework.jdk.core.type.Named;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.UuidIdentity;
@@ -266,4 +267,19 @@ public class MockWorkItem implements IAtsWorkItem {
return getStateMgr().getStateType().isCancelled();
}
+ @Override
+ public int compareTo(Named o) {
+ return 0;
+ }
+
+ @Override
+ public boolean isDecisionReview() {
+ return false;
+ }
+
+ @Override
+ public boolean isPeerReview() {
+ return false;
+ }
+
}

Back to the top