added test cases to TestVServerInfo.java
[appc.git] / appc-outbound / appc-aai-client / provider / src / test / java / org / onap / appc / aai / client / aai / TestVServerInfo.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2019 IBM.
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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  * 
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.appc.aai.client.aai;
23
24 import static org.junit.Assert.assertEquals;
25
26 import java.util.HashMap;
27 import java.util.Map;
28
29 import org.junit.Before;
30 import org.junit.Test;
31
32 public class TestVServerInfo {
33
34     VServerInfo vServerInfo;
35
36     @Before
37     public void setUp() throws MissingParameterException {
38         Map<String, String> params = new HashMap<>();
39         params.put("vserverId", "testVserverId");
40         params.put("tenantId", "testTenantId");
41         params.put("cloudOwner", "testCloudOwner");
42         params.put("cloudRegionId", "testCloudRegionId");
43         vServerInfo = new VServerInfo(params);
44     }
45
46     @Test
47     public void testVserverId() {
48         assertEquals("testVserverId", vServerInfo.getVserverId());
49     }
50
51     @Test
52     public void testTenantId() {
53         assertEquals("testTenantId", vServerInfo.getTenantId());
54     }
55
56     @Test
57     public void testCloudOwner() {
58         assertEquals("testCloudOwner", vServerInfo.getCloudOwner());
59     }
60
61     @Test
62     public void testCloudRegionId() {
63         assertEquals("testCloudRegionId", vServerInfo.getCloudRegionId());
64     }
65     
66     @Test(expected = MissingParameterException.class)
67     public void testConstructorWithEmptyVserverId() throws MissingParameterException {
68         Map<String, String> params = new HashMap<>();
69         params.put("vserverId", "");
70         vServerInfo = new VServerInfo(params);
71     }
72     
73     @Test(expected = MissingParameterException.class)
74     public void testConstructorWithEmptyTenantId() throws MissingParameterException {
75         Map<String, String> params = new HashMap<>();
76         params.put("vserverId", "testVserverId");
77         params.put("tenantId", "");
78         vServerInfo = new VServerInfo(params);
79     }
80     
81     @Test(expected = MissingParameterException.class)
82     public void testConstructorWithEmptyCloudOwner() throws MissingParameterException {
83         Map<String, String> params = new HashMap<>();
84         params.put("vserverId", "testVserverId");
85         params.put("tenantId", "testTenantId");
86         params.put("cloudOwner", "");
87         vServerInfo = new VServerInfo(params);
88     }
89     
90     @Test(expected = MissingParameterException.class)
91     public void testConstructorWithEmptyCloudRegionId() throws MissingParameterException {
92         Map<String, String> params = new HashMap<>();
93         params.put("vserverId", "testVserverId");
94         params.put("tenantId", "testTenantId");
95         params.put("cloudOwner", "testCloudOwner");
96         params.put("cloudRegionId", "");
97         vServerInfo = new VServerInfo(params);
98     }
99
100 }