From: LiZi Date: Fri, 2 Mar 2018 08:15:20 +0000 (-0500) Subject: Add unit test for the newly entity classes. X-Git-Tag: v1.1.0~13^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fesr-server.git;a=commitdiff_plain;h=59a95d6dfa955aa13dade154233431550e48d1ac;ds=sidebyside Add unit test for the newly entity classes. Change-Id: Ie87f678cdaab10322211b546d5defa1e17a8b3c8 Issue-ID: AAI-831 Signed-off-by: LiZi --- 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 index 0000000..44d907d --- /dev/null +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexListTest.java @@ -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 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 index 0000000..9cb543d --- /dev/null +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexTest.java @@ -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 index 0000000..fad6610 --- /dev/null +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipDataTest.java @@ -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 index 0000000..f691b36 --- /dev/null +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipTest.java @@ -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 relationshipDatas = new ArrayList<>(); + RelationshipData relationshipData = new RelationshipData(); + relationshipData.setRelationshipKey("relationship-key"); + relationshipData.setRelationshipValue("123"); + relationshipDatas.add(relationshipData); + relationship.setRelationshipData(relationshipDatas); + assertEquals(relationship.getRelationshipData(), relationshipDatas); + } +}