08b70ba52359546187f0975adfb917d84001aa26
[appc.git] / appc-dg / appc-dg-shared / appc-dg-domain-model-lib / src / test / java / org / onap / appc / domainmodel / TestVnf.java
1 /*
2 * ============LICENSE_START=======================================================
3 * ONAP : APPC
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
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 * ============LICENSE_END=========================================================
19 */
20 package org.onap.appc.domainmodel;
21
22 import static org.junit.Assert.assertEquals;
23 import static org.junit.Assert.assertNotEquals;
24 import static org.junit.Assert.assertNotNull;
25 import static org.junit.Assert.assertTrue;
26
27 import java.util.LinkedList;
28 import java.util.List;
29
30 import org.junit.Before;
31 import org.junit.Test;
32
33 public class TestVnf {
34     private Vnf vnf;
35
36     @Before
37     public void SetUp() {
38         vnf=new Vnf();
39     }
40
41     @Test
42     public void testGetVnfId() {
43         vnf.setVnfId("Z");
44         assertNotNull(vnf.getVnfId());
45         assertEquals(vnf.getVnfId(),"Z");
46     }
47
48     @Test
49     public void testGetvnfType() {
50         vnf.setVnfType("A");
51         assertNotNull(vnf.getVnfType());
52         assertEquals(vnf.getVnfType(),"A");
53     }
54
55     @Test
56     public void testGetVnfVersion() {
57         vnf.setVnfVersion("1.0");
58         assertNotNull(vnf.getVnfVersion());
59         assertEquals(vnf.getVnfVersion(),"1.0");
60     }
61
62     @Test
63     public void testList() {
64         List<Vserver> vservers = new LinkedList<>();
65         vnf.setVservers(vservers);
66         assertNotNull(vnf.getVservers());
67         assertEquals(vnf.getVservers(),vservers);
68         
69     }
70
71     @Test
72     public void testToString_ReturnNonEmptyString() {
73         assertNotEquals(vnf.toString(), "");
74         assertNotEquals(vnf.toString(), null);
75     }
76
77     @Test
78     public void testToString_ContainsString() {
79         assertTrue(vnf.toString().contains("vnfId"));
80     }
81
82 }