Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2015-10-22 11:10:18 -0400
committermegumi.telles2015-10-23 13:59:57 -0400
commit1ca04e55c39eefd02db757b61b88d051ca25c099 (patch)
treeaa279b1a799846cbd50f3fb4e049f55d78502316 /plugins/org.eclipse.osee.ats.core.test
parent32c45f9e56a579225aef5b0f43ec3b95d8cc5c9d (diff)
downloadorg.eclipse.osee-1ca04e55c39eefd02db757b61b88d051ca25c099.tar.gz
org.eclipse.osee-1ca04e55c39eefd02db757b61b88d051ca25c099.tar.xz
org.eclipse.osee-1ca04e55c39eefd02db757b61b88d051ca25c099.zip
bug[ats_ATS250883]: Fix exception during 'Create TRAX Related Action'
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/workdef/AtsWorkDefinitionAdminImplTest.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/workdef/AtsWorkDefinitionAdminImplTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/workdef/AtsWorkDefinitionAdminImplTest.java
index 38b2b82dde..0095b44862 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/workdef/AtsWorkDefinitionAdminImplTest.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/workdef/AtsWorkDefinitionAdminImplTest.java
@@ -29,6 +29,7 @@ import org.eclipse.osee.ats.api.workdef.IAtsWorkDefinitionService;
import org.eclipse.osee.ats.api.workdef.IAtsWorkDefinitionStore;
import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
import org.eclipse.osee.ats.api.workdef.IWorkDefinitionMatch;
+import org.eclipse.osee.ats.api.workflow.IAtsTask;
import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.api.workflow.IAtsWorkItemService;
import org.eclipse.osee.ats.core.util.CacheProvider;
@@ -49,6 +50,7 @@ import org.mockito.MockitoAnnotations;
public class AtsWorkDefinitionAdminImplTest {
private static final String MyPeerToPeerWorkDefId = "myPeerToPeerWorkDef";
+ private static final String MyTaskWorkDefId = "WorkDef_Task_Test_Review";
// @formatter:off
@Mock IAtsTeamDefinition topTeamDef;
@@ -63,9 +65,11 @@ public class AtsWorkDefinitionAdminImplTest {
@Mock IAtsTeamWorkflow teamWf;
@Mock IAtsWorkDefinition defaultPeerToPeerWorkDef;
@Mock IAtsWorkDefinition myPeerToPeerWorkDef;
+ @Mock IAtsWorkDefinition myTaskWorkDef;
@Mock ITeamWorkflowProvidersLazy teamWorkflowProviders;
@Mock CacheProvider<AtsWorkDefinitionCache> cacheProvider;
@Mock IAttributeResolver attributeResolver;
+ @Mock IAtsTask task;
private AtsWorkDefinitionAdminImpl workDefAmin;
@@ -87,8 +91,8 @@ public class AtsWorkDefinitionAdminImplTest {
AtsWorkDefinitionCache cache = new AtsWorkDefinitionCache();
when(cacheProvider.get()).thenReturn(cache);
- workDefAmin = new AtsWorkDefinitionAdminImpl(cacheProvider, workDefinitionService, attributeResolver,
- teamWorkflowProviders);
+ workDefAmin =
+ new AtsWorkDefinitionAdminImpl(cacheProvider, workDefinitionService, attributeResolver, teamWorkflowProviders);
}
@Test
@@ -221,4 +225,16 @@ public class AtsWorkDefinitionAdminImplTest {
assertEquals(defaultPeerToPeerWorkDef, match.getWorkDefinition());
}
+ @Test
+ public void testGetWorkDefinitionForTaskWithSpecifiedId() throws Exception {
+ List<Object> attrValues = new ArrayList<>();
+ attrValues.add(MyTaskWorkDefId);
+
+ when(attributeResolver.getAttributeValues(task, AtsAttributeTypes.WorkflowDefinition)).thenReturn(attrValues);
+ when(workDefinitionService.getWorkDef(eq(MyTaskWorkDefId), any(XResultData.class))).thenReturn(myTaskWorkDef);
+
+ IWorkDefinitionMatch match = workDefAmin.getWorkDefinitionForTask(task);
+ assertEquals(match.getWorkDefinition(), myTaskWorkDef);
+ }
+
}

Back to the top