summaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authorAnjali walsatwar <anjali.walsatwar@huawei.com>2018-10-05 14:14:27 +0530
committerMichael Lando <michael.lando@intl.att.com>2018-10-08 06:41:54 +0000
commitc31b73a86a38ab45fa833016a18637f6431918db (patch)
treee23073c2a26548db657950aacfbd5b853dc68db1 /catalog-be/src
parent453831564d4af7eb7603a50a2d75505ad858db2b (diff)
UT for catalog be datamodel
UT for catalog be datamodel class Issue-ID: SDC-1775 Change-Id: Id1a9a8c32fc674a553a1fd5d40426b0c08b07d15 Signed-off-by: Anjali walsatwar <anjali.walsatwar@huawei.com>
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ForwardingPathsTest.java21
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairTest.java10
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairWrapperTest.java9
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ServiceRelationsTest.java37
4 files changed, 77 insertions, 0 deletions
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
index 0000000000..ba5f4cb0a7
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ForwardingPathsTest.java
@@ -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
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairTest.java
index f2a468207b..cc6c03bdd5 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairTest.java
@@ -21,6 +21,16 @@ public class NameIdPairTest {
}
@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;
String name = "";
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairWrapperTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairWrapperTest.java
index 452d02d3ea..4f6e7cace4 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairWrapperTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/NameIdPairWrapperTest.java
@@ -20,6 +20,15 @@ public class NameIdPairWrapperTest {
}
@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;
String result;
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
index 0000000000..dc89f1ed37
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/ServiceRelationsTest.java
@@ -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