2 * ============LICENSE_START=======================================================
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
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.
19 * ============LICENSE_END=========================================================
22 package org.onap.appc.aai.client.aai;
24 import static org.junit.Assert.assertEquals;
26 import java.util.HashMap;
29 import org.junit.Before;
30 import org.junit.Test;
32 public class TestVServerInfo {
34 VServerInfo vServerInfo;
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);
47 public void testVserverId() {
48 assertEquals("testVserverId", vServerInfo.getVserverId());
52 public void testTenantId() {
53 assertEquals("testTenantId", vServerInfo.getTenantId());
57 public void testCloudOwner() {
58 assertEquals("testCloudOwner", vServerInfo.getCloudOwner());
62 public void testCloudRegionId() {
63 assertEquals("testCloudRegionId", vServerInfo.getCloudRegionId());
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);
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);