UT for catalog be datamodel 98/69898/2
authorAnjali walsatwar <anjali.walsatwar@huawei.com>
Fri, 5 Oct 2018 08:44:27 +0000 (14:14 +0530)
committerMichael Lando <michael.lando@intl.att.com>
Mon, 8 Oct 2018 06:41:54 +0000 (06:41 +0000)
UT for catalog be datamodel class

Issue-ID: SDC-1775

Change-Id: Id1a9a8c32fc674a553a1fd5d40426b0c08b07d15
Signed-off-by: Anjali walsatwar <anjali.walsatwar@huawei.com>
catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ForwardingPathsTest.java [new file with mode: 0644]
catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairWrapperTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ServiceRelationsTest.java [new file with mode: 0644]

diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ForwardingPathsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ForwardingPathsTest.java
new file mode 100644 (file)
index 0000000..ba5f4cb
--- /dev/null
@@ -0,0 +1,21 @@
+package org.openecomp.sdc.be.datamodel;
+
+import org.junit.Test;
+
+import java.util.Set;
+import java.util.*;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ForwardingPathsTest {
+
+       @Test
+       public void testForwardingPaths()  {
+               ForwardingPaths testForwardingPaths = new ForwardingPaths();
+               Set<String> path= new HashSet<>(Arrays.asList("test"));
+               testForwardingPaths.setForwardingPathToDelete(path);
+               Set<String> getPath = testForwardingPaths.getForwardingPathToDelete();
+               assertThat(getPath).isEqualTo(path);
+       }
+
+}
\ No newline at end of file
index f2a4682..cc6c03b 100644 (file)
@@ -20,6 +20,16 @@ public class NameIdPairTest {
                result = testSubject.getName();
        }
 
+       @Test
+       public void testConstructorWith3Parameters() throws Exception {
+               NameIdPair testSubject;
+               String result;
+
+               // default test
+               testSubject =  new NameIdPair("", "","");
+               result = testSubject.getOwnerId();
+       }
+
        @Test
        public void testSetName() throws Exception {
                NameIdPair testSubject;
index 452d02d..4f6e7ca 100644 (file)
@@ -19,6 +19,15 @@ public class NameIdPairWrapperTest {
                testSubject.init(nameIdPair);
        }
 
+       @Test
+       public void testInitWithObject() throws Exception {
+               NameIdPairWrapper testSubject;
+               NameIdPair nameIdPair = new NameIdPair("mock", "mock");
+
+               // default test
+               testSubject = new NameIdPairWrapper(nameIdPair);
+       }
+
        @Test
        public void testGetId() throws Exception {
                NameIdPairWrapper testSubject;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ServiceRelationsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ServiceRelationsTest.java
new file mode 100644 (file)
index 0000000..dc89f1e
--- /dev/null
@@ -0,0 +1,37 @@
+package org.openecomp.sdc.be.datamodel;
+
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ServiceRelationsTest {
+
+       private NameIdPair getNameIdPairWrapper() {
+               return new NameIdPair("mock", "mock");
+       }
+
+       @Test
+       public void testServiceRelations()  {
+
+               NameIdPairWrapper testNameIdPairWrapper;
+               NameIdPair nameIdPair = new NameIdPair("mock", "mock");
+
+               testNameIdPairWrapper =  new NameIdPairWrapper();
+               testNameIdPairWrapper.init(nameIdPair);
+
+               Set<NameIdPairWrapper> result = new HashSet<NameIdPairWrapper>();
+               result.add(testNameIdPairWrapper);
+
+
+               ServiceRelations testServiceRelations = new ServiceRelations();
+               ServiceRelations testServiceRelationsWithRelations = new ServiceRelations(result);
+               testServiceRelations.setRelations(result);
+               Set<NameIdPairWrapper> getResult = testServiceRelations.getRelations();
+               assertThat(getResult).isEqualTo(result);
+       }
+
+}
\ No newline at end of file