add unit test
[vfc/nfvo/driver/sfc.git] / zte / sfc-driver / sfc-driver / src / test / java / org / onap / sfc / entity / MsbRegisterEntityTest.java
1 package org.onap.sfc.entity;
2
3 import org.junit.Before;
4 import org.junit.Test;
5
6 import java.util.ArrayList;
7 import java.util.List;
8
9 /**
10  * Copyright 2018 ZTE Corporation.
11  * <p>
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  * <p>
16  * http://www.apache.org/licenses/LICENSE-2.0
17  * <p>
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */
24 public class MsbRegisterEntityTest {
25     MsbRegisterEntity entity1;
26     MsbRegisterEntity entity2;
27     List<NodeEntity> nodes = new ArrayList<>();
28
29
30     @Before
31     public void setUp() throws Exception {
32         entity1 = new MsbRegisterEntity();
33         entity1.setServiceName("serviceName");
34         entity1.setNodes(nodes);
35         entity1.setProtocol("http");
36         entity1.setUrl("http://127.0.0.1");
37         entity1.setVersion("1.0");
38         entity1.setVisualRange("0-6");
39
40         entity2 = new MsbRegisterEntity();
41         entity2.setVisualRange(entity1.getVisualRange());
42         entity2.setVersion(entity1.getVersion());
43         entity2.setUrl(entity1.getUrl());
44         entity2.setServiceName(entity1.getServiceName());
45         entity2.setNodes(entity1.getNodes());
46         entity2.setProtocol(entity1.getProtocol());
47     }
48
49     @Test
50     public void test() throws Exception {
51         assert entity2.getNodes().equals(entity1.getNodes());
52         assert entity2.getProtocol().equals(entity1.getProtocol());
53         assert entity2.getServiceName().equals(entity1.getServiceName());
54         assert entity2.getUrl().equals(entity1.getUrl());
55         assert entity2.getVersion().equals(entity1.getVersion());
56         assert entity2.getVisualRange().equals(entity1.getVisualRange());
57     }
58
59
60     @Test
61     public void equals() throws Exception {
62         assert !entity2.equals(entity1);
63         assert entity2.equals(entity2);
64 /*        MsbRegisterEntity entity = new MsbRegisterEntity();
65         assert entity2.equals(entity1);
66         assert entity2.equals(entity2);
67         assert !entity2.equals(null);
68         assert !entity.equals(entity2);
69         assert !entity2.equals(entity);*/
70     }
71
72     @Test
73     public void toStringTest() {
74         assert entity2.toString() != null;
75     }
76
77 }