Sonar fix too mnay method param
[portal.git] / ecomp-portal-BE-common / src / test / java / org / onap / portalapp / portal / transport / CentralRoleTest.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the "License");
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * 
37  */
38 package org.onap.portalapp.portal.transport;
39
40 import static org.junit.Assert.*;
41
42 import java.util.Date;
43 import java.util.SortedSet;
44 import java.util.TreeSet;
45
46 import org.junit.Test;
47
48 public class CentralRoleTest {
49
50         CentralRole centralRole= new CentralRole.CentralRoleBuilder().createCentralRole();
51         
52         
53         /*public CentralV2Role mockCentralRole(){
54                 CentralV2Role centralV2Role = new CentralV2Role((long)1, null, null, (long)1, (long)1, (long)1,
55                                 "test", false, 1, null, null, null);
56             
57             centralV2Role.setId((long)1);
58             centralV2Role.setCreatedId((long)1);
59             centralV2Role.setModifiedId((long)1);
60             centralV2Role.setRowNum((long)1);
61             centralV2Role.setName("test");
62             centralV2Role.setActive(false);
63             centralV2Role.setPriority(1);
64             
65             centralV2Role.setCreated(null);
66             centralV2Role.setModified(null);
67             centralV2Role.setRoleFunctions(null);
68             centralV2Role.setChildRoles(null);
69             centralV2Role.setParentRoles(null);
70             
71                 return centralV2Role;
72         }
73         
74         @Test
75         public void centralRoleTest(){
76                 CentralV2Role centralV2Role = mockCentralRole();
77                 
78                 CentralV2Role centralRole1 = new CentralV2Role((long)1, null, null, (long)1, (long)1, (long)1,
79                                 "test", false, 1, null, null, null);
80                 
81                 CentralV2Role centralRole2 = new CentralV2Role((long)1, "test");
82                 
83                 assertEquals(centralV2Role.getId(), new Long(1));
84                 assertEquals(centralV2Role.getCreatedId(), new Long(1));
85                 assertEquals(centralV2Role.getModifiedId(), new Long(1));
86                 assertEquals(centralV2Role.getRowNum(), new Long(1));
87                 assertEquals(centralV2Role.getName(), "test");
88                 assertEquals(centralV2Role.getActive(), false);
89                 assertEquals(centralV2Role.getCreated(), null);
90                 assertEquals(centralV2Role.getModified(), null);
91                 assertEquals(centralV2Role.getRoleFunctions(), null);
92                 assertEquals(centralV2Role.getChildRoles(), null);
93                 assertEquals(centralV2Role.getParentRoles(), null);             
94                 assertEquals(centralV2Role.getPriority().toString(), "1");
95                 assertEquals(centralV2Role.hashCode(), centralRole1.hashCode());
96                 assertTrue(centralV2Role.equals(centralRole1));
97                 assertEquals(centralV2Role, centralRole1);
98                 assertEquals(centralRole2, new CentralV2Role((long)1, "test"));
99         }*/
100         
101         @Test
102     public void unt_centralRoleConstructorTest() {
103         centralRole = new CentralRole.CentralRoleBuilder().setId(null).setCreated(null).setModified(null)
104                 .setCreatedId(null).setModifiedId(null).setRowNum(null).setName(null).setActive(false).setPriority(null)
105                 .setRoleFunctions(null).setChildRoles(null).setParentRoles(null).createCentralRole();
106         assertEquals(false, centralRole.isActive());
107     }
108         
109         @Test
110     public void unt_centralRoleConstructor2Test() {
111         centralRole = new CentralRole.CentralRoleBuilder().setId(null).setName(null).setActive(false).setPriority(null)
112                 .setRoleFunctions(null).createCentralRole();
113         assertEquals(false, centralRole.isActive());
114     }
115         
116         @Test
117         public void unt_IdTest(){
118                 Long defaultValue=123L;
119                 centralRole.setId(defaultValue);
120                 assertEquals(defaultValue, centralRole.getId());
121         }
122         
123         @Test
124         public void unt_createdTest(){
125                 Date defaultValue=new Date();
126                 centralRole.setCreated(defaultValue);
127                 assertEquals(defaultValue, centralRole.getCreated());
128         }
129         
130         @Test
131         public void unt_modifiedTest(){
132                 Date defaultValue=new Date();
133                 centralRole.setModified(defaultValue);
134                 assertEquals(defaultValue, centralRole.getModified());
135         }
136         
137         @Test
138         public void unt_modifiedIdTest(){
139                 Long defaultValue=123L;
140                 centralRole.setModifiedId(defaultValue);
141                 assertEquals(defaultValue, centralRole.getModifiedId());
142         }
143         
144         @Test
145         public void unt_createdIdTest(){
146                 Long defaultValue=123L;
147                 centralRole.setCreatedId(defaultValue);
148                 assertEquals(defaultValue, centralRole.getCreatedId());
149         }
150         
151         @Test
152         public void unt_rowNumTest(){
153                 Long defaultValue=123L;
154                 centralRole.setRowNum(defaultValue);
155                 assertEquals(defaultValue, centralRole.getRowNum());
156         }
157         
158         @Test
159         public void unt_nameTest(){
160                 String defaultValue="test";
161                 centralRole.setName(defaultValue);
162                 assertEquals(defaultValue, centralRole.getName());
163         }
164         
165         @Test
166         public void unt_activeTest(){
167                 Boolean defaultValue=false;
168                 centralRole.setActive(defaultValue);
169                 assertEquals(defaultValue, centralRole.isActive());
170         }
171         
172         @Test
173         public void unt_priorityTest(){
174                 Integer defaultValue=123;
175                 centralRole.setPriority(defaultValue);
176                 assertEquals(defaultValue, centralRole.getPriority());
177         }
178         
179         @Test
180         public void unt_getRoleFunctionsTest(){
181                 //Integer defaultValue=123;
182                 SortedSet<CentralRoleFunction> roleFunctions = new TreeSet<>();
183                 CentralRoleFunction centralRoleFunction=new CentralRoleFunction();
184                 roleFunctions.add(centralRoleFunction);
185                 centralRole.setRoleFunctions(roleFunctions);
186                 assertNotNull(centralRole.getRoleFunctions());
187         }
188         
189         @Test
190         public void unt_childRolesTest(){
191                 //Integer defaultValue=123;
192                 SortedSet<CentralRole> centralRoles=new TreeSet<>();
193                 //CentralRole centralRole=new CentralRole();
194                 //centralRoles.add(centralRole);
195                 centralRole.setChildRoles(centralRoles);
196                 assertNotNull(centralRole.getChildRoles());
197         }
198         
199         @Test
200         public void unt_parentRolesTest(){
201                 //Integer defaultValue=123;
202                 SortedSet<CentralRole> centralRoles=new TreeSet<>();
203                 centralRole.setParentRoles(centralRoles);
204                 assertNotNull(centralRole.getParentRoles());
205         }
206         
207 }