diff options
author | LiZi <li.zi30@zte.com.cn> | 2018-03-02 03:15:20 -0500 |
---|---|---|
committer | LiZi <li.zi30@zte.com.cn> | 2018-03-02 03:15:26 -0500 |
commit | 59a95d6dfa955aa13dade154233431550e48d1ac (patch) | |
tree | b85e309d288ce1d2272538b2c8cbf89127cf6a7b /esr-mgr | |
parent | 0ab46140874180b586d578c79c75621697b7a3b1 (diff) |
Add unit test for the newly entity classes.
Change-Id: Ie87f678cdaab10322211b546d5defa1e17a8b3c8
Issue-ID: AAI-831
Signed-off-by: LiZi <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-mgr')
4 files changed, 161 insertions, 0 deletions
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<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 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<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); + } +} |