Code coverage should be at least 55%
[vfc/nfvo/driver/vnfm/svnfm.git] / huawei / vnfmadapter / VnfmadapterService / service / src / test / java / org / onap / vfc / nfvo / vnfm / svnfm / vnfmadapter / service / entity / VnfmTest.java
1 /*
2  * Copyright 2016 Huawei Technologies Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.entity;
18
19 import static org.junit.Assert.*;
20
21 import org.junit.Before;
22 import org.junit.Test;
23 import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.entity.Vnfm;
24
25 public class VnfmTest {
26     Vnfm vnfm;
27
28     @Before
29     public void setUp(){
30         vnfm = new Vnfm();
31         vnfm.setId("123");
32         vnfm.setId("v1");
33         vnfm.setVnfdId("1234");
34         vnfm.setVnfPackageId("abcd");
35     }
36
37     @Test
38     public void hashCodeTest(){
39         Vnfm tempVnfm = new Vnfm();
40         tempVnfm.setId("123");
41         tempVnfm.setId("v1");
42         tempVnfm.setVnfdId("1234");
43         tempVnfm.setVnfPackageId("abcd");
44         assertTrue(vnfm.hashCode() == tempVnfm.hashCode());
45     }
46
47     @Test
48     public void equalsTest1(){
49         Vnfm tempVnfm = new Vnfm();
50         tempVnfm.setId("123");
51         tempVnfm.setId("v1");
52         tempVnfm.setVnfdId("1234");
53         tempVnfm.setVnfPackageId("abcd");
54         assertTrue(vnfm.equals(tempVnfm));
55     }
56
57     @Test
58     public void testProps(){
59         Vnfm tempVnfm = new Vnfm();
60         tempVnfm.getId();
61         tempVnfm.setId("123");
62         tempVnfm.getVersion();
63         tempVnfm.setVersion("1234");
64         tempVnfm.getVnfdId();
65         tempVnfm.setVnfdId("123");
66         tempVnfm.getVnfPackageId();
67         tempVnfm.setVnfPackageId("123");
68         tempVnfm.toString();
69         assertTrue(true);
70     }
71
72
73     @Test
74     public void equalsTest2(){
75         assertTrue(vnfm.equals(vnfm));
76     }
77
78     @Test
79     public void equalsTest3(){
80
81         assertTrue(!vnfm.equals(null));
82     }
83     @Test
84     public void equalsTest4(){
85
86         assertTrue(!vnfm.equals(new Object()));
87     }
88     @Test
89     public void equalsTest5(){
90
91         assertTrue(!vnfm.equals(new Object()));
92     }
93
94 }