2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2018 TechMahindra
6 *=================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.appc.dg.aai.objects;
22 import java.util.HashMap;
25 import org.junit.Assert;
26 import org.junit.Before;
27 import org.junit.Test;
29 public class TestAAIQueryResult {
30 private AAIQueryResult aaiQueryResult;
31 private Map<String,String> additionProperties;
36 aaiQueryResult=new AAIQueryResult();
37 additionProperties = new HashMap<>();
41 public void testGetRelationshipList() {
42 Assert.assertTrue(aaiQueryResult. getRelationshipList().isEmpty());
46 public void testGetRelationshipList_With_Data() {
47 Relationship r1=new Relationship();
48 r1.setRelatedLink("relatedLink");
49 r1.setRelatedTo("relatedTo");
50 r1.getRelatedProperties().put("1", "A");
51 r1.getRelationShipDataMap().put("B", "b");
52 aaiQueryResult.getRelationshipList().add(r1);
53 Assert.assertEquals(1,aaiQueryResult.getRelationshipList().size());
57 public void testGetAdditionProperties_IsEmpty() {
58 Assert.assertTrue(aaiQueryResult. getAdditionProperties().isEmpty());
62 public void testGetAdditionProperties_With_Data() {
63 additionProperties.put("1", "A");
64 Assert.assertTrue(additionProperties.containsKey("1"));
68 public void testGetAdditionProperties_WithValidKey() {
69 additionProperties.put("2", "B");
70 Assert.assertEquals("B",additionProperties.get("2"));
74 public void testGetAdditionProperties_WithInValidKey() {
75 Assert.assertEquals(null,additionProperties.get("3"));
79 public void testGetAdditionProperties_Size() {
80 additionProperties.put("3", "C");
81 additionProperties.put("4", "D");
82 Assert.assertEquals(2, additionProperties.size());