Merge "Add unit test for the newly entity classes."
authorLi Zi <li.zi30@zte.com.cn>
Fri, 2 Mar 2018 08:24:17 +0000 (08:24 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 2 Mar 2018 08:24:17 +0000 (08:24 +0000)
esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexListTest.java [new file with mode: 0644]
esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexTest.java [new file with mode: 0644]
esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipDataTest.java [new file with mode: 0644]
esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipTest.java [new file with mode: 0644]

diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexListTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexListTest.java
new file mode 100644 (file)
index 0000000..44d907d
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+
+public class ComplexListTest {
+    
+    @Test
+    public void getterAndSetter4complex() {
+        ComplexList complexlist = new ComplexList();
+        List<Complex> complexes = new ArrayList<>();
+        Complex complex = new Complex();
+        complex.setComplexName("test");
+        complex.setPhysicalLocationId("123");
+        complexes.add(complex);
+        complexlist.setComplex(complexes);
+        assertEquals(complexlist.getComplex(), complexes);
+    }
+}
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexTest.java
new file mode 100644 (file)
index 0000000..9cb543d
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class ComplexTest {
+    @Test
+    public void getterAndSetter4physicalLocationId() {
+        final String physicalLocationId = "123";
+        Complex complex = new Complex();
+        complex.setPhysicalLocationId(physicalLocationId);
+        assertEquals(complex.getPhysicalLocationId(), physicalLocationId);
+    }
+
+    @Test
+    public void getterAndSetter4complexName() {
+        final String complexName = "complex-test";
+        Complex complex = new Complex();
+        complex.setComplexName(complexName);
+        assertEquals(complex.getComplexName(), complexName);
+    }
+}
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipDataTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipDataTest.java
new file mode 100644 (file)
index 0000000..fad6610
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class RelationshipDataTest {
+    @Test
+    public void getterAndSetter4relationshipKey() {
+        final String relationshipKey = "relationship-key";
+        RelationshipData relationshipData = new RelationshipData();
+        relationshipData.setRelationshipKey(relationshipKey);
+        assertEquals(relationshipData.getRelationshipKey(), relationshipKey);
+    }
+    
+    @Test
+    public void getterAndSetter4relationshipValue() {
+        final String relationshipValue = "123";
+        RelationshipData relationshipData = new RelationshipData();
+        relationshipData.setRelationshipValue(relationshipValue);
+        assertEquals(relationshipData.getRelationshipValue(), relationshipValue);
+    }
+}
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipTest.java
new file mode 100644 (file)
index 0000000..f691b36
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+
+public class RelationshipTest {
+    @Test
+    public void getterAndSetter4relatedTo() {
+        final String relatedTo = "relationship-key";
+        Relationship relationship = new Relationship();
+        relationship.setRelatedTo(relatedTo);
+        assertEquals(relationship.getRelatedTo(), relatedTo);
+    }
+    
+    @Test
+    public void getterAndSetter4relatedLink() {
+        final String relatedLink = "123";
+        Relationship relationship = new Relationship();
+        relationship.setRelatedLink(relatedLink);
+        assertEquals(relationship.getRelatedLink(), relatedLink);
+    }
+    
+    @Test
+    public void getterAndSetter4relationshipData() {
+        Relationship relationship = new Relationship();
+        List<RelationshipData> relationshipDatas = new ArrayList<>();
+        RelationshipData relationshipData = new RelationshipData();
+        relationshipData.setRelationshipKey("relationship-key");
+        relationshipData.setRelationshipValue("123");
+        relationshipDatas.add(relationshipData);
+        relationship.setRelationshipData(relationshipDatas);
+        assertEquals(relationship.getRelationshipData(), relationshipDatas);
+    }
+}