Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2015-09-29 19:05:22 -0400
committerRyan D. Brooks2015-09-29 19:05:22 -0400
commitdf21349e9006f29c3899442136f11585447967ee (patch)
tree903d0d4505daf6d6ccf16656c61f4d35e7cb58b9 /plugins/org.eclipse.osee.ats.core.test
parent5cf5ade0214d5da64c01e5fcf7914d650df848e7 (diff)
downloadorg.eclipse.osee-df21349e9006f29c3899442136f11585447967ee.tar.gz
org.eclipse.osee-df21349e9006f29c3899442136f11585447967ee.tar.xz
org.eclipse.osee-df21349e9006f29c3899442136f11585447967ee.zip
bug[ats_ATS244360]: Fix AtsClientImpl.getAtsId0.23.0
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/AtsCoreServiceImplTest.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/AtsCoreServiceImplTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/AtsCoreServiceImplTest.java
new file mode 100644
index 0000000000..a4dded8b1b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/util/AtsCoreServiceImplTest.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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 org.eclipse.osee.ats.api.IAtsObject;
+import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
+import org.eclipse.osee.framework.core.data.ArtifactId;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+/**
+ * Test Case for {@link AtsCoreServiceImpl}
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsCoreServiceImplTest {
+
+ // @formatter:off
+ @Mock private ArtifactId artifact;
+ @Mock private IAtsObject atsObject;
+ @Mock private IAttributeResolver attrResolver;
+ // @formatter:on
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testGetAtsId() {
+ when(attrResolver.getSoleAttributeValue(artifact, AtsAttributeTypes.AtsId, null)).thenReturn(null);
+ when(artifact.getGuid()).thenReturn("guid");
+ String result = AtsCoreServiceImpl.getAtsId(attrResolver, artifact);
+ assertEquals(result, "guid");
+
+ when(attrResolver.getSoleAttributeValue(atsObject, AtsAttributeTypes.AtsId, null)).thenReturn(null);
+ when(atsObject.getStoreObject()).thenReturn(artifact);
+ result = AtsCoreServiceImpl.getAtsId(attrResolver, atsObject);
+ assertEquals(result, "guid");
+
+ when(attrResolver.getSoleAttributeValue(artifact, AtsAttributeTypes.AtsId, null)).thenReturn("ATS23");
+ result = AtsCoreServiceImpl.getAtsId(attrResolver, artifact);
+ assertEquals(result, "ATS23");
+
+ when(attrResolver.getSoleAttributeValue(atsObject, AtsAttributeTypes.AtsId, null)).thenReturn("ATS23");
+ assertEquals(result, "ATS23");
+ }
+
+}

Back to the top