JUnits for coverage
[portal.git] / ecomp-portal-BE-common / src / test / java / org / onap / portalapp / portal / transport / CentralAppTest.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
44 import org.junit.Test;
45 import org.onap.portalapp.portal.transport.CentralApp;
46
47 public class CentralAppTest {
48         
49         CentralApp centralApp=new CentralApp();
50
51         public CentralApp mockCentralApp(){
52                 CentralApp centralApp = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
53                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
54                                 return centralApp;
55         }
56         
57         @Test
58         public void centralAppTest(){
59                 CentralApp centralApp = mockCentralApp();
60                 
61                 CentralApp centralApp1 =  new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
62                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
63                 
64                 assertEquals(centralApp.getId(), new Long(1));
65                 assertEquals(centralApp.getCreatedId(), new Long(1));
66                 assertEquals(centralApp.getModifiedId(), new Long(1));
67                 assertEquals(centralApp.getRowNum(), new Long(1));
68                 assertEquals(centralApp.getName(), "test");
69                 assertEquals(centralApp.getImageUrl(), "test");
70                 assertEquals(centralApp.getDescription(), "test");
71                 assertEquals(centralApp.getNotes(), "test");
72                 assertEquals(centralApp.getUrl(), "test");
73                 assertEquals(centralApp.getAlternateUrl(), "test");
74                 assertEquals(centralApp.getRestEndpoint(), "test");
75                 assertEquals(centralApp.getMlAppName(), "test");
76                 assertEquals(centralApp.getMlAppAdminId(), "test");
77                 assertEquals(centralApp.getMotsId(), "test");
78                 assertEquals(centralApp.getAppPassword(), "test");
79                 assertEquals(centralApp.getOpen(), "test");
80                 assertEquals(centralApp.getEnabled(), "test");
81                 assertEquals(centralApp.getUsername(), "test");
82                 assertEquals(centralApp.getUebKey(), "test");
83                 assertEquals(centralApp.getUebSecret(), "test");
84                 assertEquals(centralApp.getUebTopicName(), "test");
85                 
86                 assertTrue(centralApp.equals(centralApp1));
87                 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
88         }
89         
90         
91         @Test
92         public void unt_IdTest(){
93                 Long defaultValue=123L;
94                 centralApp.setId(defaultValue);
95                 assertEquals(defaultValue, centralApp.getId());
96         }
97         
98         @Test
99         public void unt_createdTest(){
100                 Date defaultValue=new Date();
101                 centralApp.setCreated(defaultValue);
102                 assertEquals(defaultValue, centralApp.getCreated());
103         }
104         
105         @Test
106         public void unt_modifiedTest(){
107                 Date defaultValue=new Date();
108                 centralApp.setCreated(defaultValue);
109                 assertEquals(defaultValue, centralApp.getCreated());
110         }
111         
112         @Test
113         public void unt_craetedIdTest(){
114                 Long defaultValue=123L;
115                 centralApp.setCreatedId(defaultValue);
116                 assertEquals(defaultValue, centralApp.getCreatedId());
117         }
118         
119         @Test
120         public void unt_modifiedIdTest(){
121                 Long defaultValue=123L;
122                 centralApp.setModifiedId(defaultValue);
123                 assertEquals(defaultValue, centralApp.getModifiedId());
124         }
125         
126         @Test
127         public void unt_rowNumTest(){
128                 Long defaultValue=123L;
129                 centralApp.setRowNum(defaultValue);
130                 assertEquals(defaultValue, centralApp.getRowNum());
131         }
132         
133
134         @Test
135         public void unt_nameTest(){
136                 String defaultValue="test";
137                 centralApp.setName(defaultValue);
138                 assertEquals(defaultValue, centralApp.getName());
139         }
140         
141         @Test
142         public void unt_ImageUrlTest(){
143                 String defaultValue="test";
144                 centralApp.setImageUrl(defaultValue);
145                 assertEquals(defaultValue, centralApp.getImageUrl());
146         }
147         
148         @Test
149         public void unt_descriptionTest(){
150                 String defaultValue="test";
151                 centralApp.setDescription(defaultValue);
152                 assertEquals(defaultValue, centralApp.getDescription());
153         }
154         
155         @Test
156         public void unt_notesTest(){
157                 String defaultValue="test";
158                 centralApp.setNotes(defaultValue);
159                 assertEquals(defaultValue, centralApp.getNotes());
160         }
161         
162         @Test
163         public void unt_urlTest(){
164                 String defaultValue="testUrl";
165                 centralApp.setUrl(defaultValue);
166                 assertEquals(defaultValue, centralApp.getUrl());
167         }
168         
169         @Test
170         public void unt_alternateUrlTest(){
171                 String defaultValue="testUrl";
172                 centralApp.setAlternateUrl(defaultValue);
173                 assertEquals(defaultValue, centralApp.getAlternateUrl());
174         }
175         
176         @Test
177         public void unt_restendpointTest(){
178                 String defaultValue="testUrl";
179                 centralApp.setRestEndpoint(defaultValue);
180                 assertEquals(defaultValue, centralApp.getRestEndpoint());
181         }
182         
183         @Test
184         public void unt_mlAppNameTest(){
185                 String defaultValue="testAppName";
186                 centralApp.setMlAppName(defaultValue);
187                 assertEquals(defaultValue, centralApp.getMlAppName());
188         }
189         
190         @Test
191         public void unt_mlAppAdminIdTest(){
192                 String defaultValue="testAppAdminId";
193                 centralApp.setMlAppAdminId(defaultValue);
194                 assertEquals(defaultValue, centralApp.getMlAppAdminId());
195         }
196         
197         @Test
198         public void unt_motsIdIdTest(){
199                 String defaultValue="testmotsid";
200                 centralApp.setMotsId(defaultValue);
201                 assertEquals(defaultValue, centralApp.getMotsId());
202         }
203         
204         @Test
205         public void unt_appPasswordTest(){
206                 String defaultValue="TestAppPassword";
207                 centralApp.setAppPassword(defaultValue);
208                 assertEquals(defaultValue, centralApp.getAppPassword());
209         }
210         
211         @Test
212         public void unt_openTest(){
213                 String defaultValue="Testopen";
214                 centralApp.setOpen(defaultValue);
215                 assertEquals(defaultValue, centralApp.getOpen());
216         }
217         
218         @Test
219         public void unt_enabledTest(){
220                 String defaultValue="Testenable";
221                 centralApp.setEnabled(defaultValue);
222                 assertEquals(defaultValue, centralApp.getEnabled());
223         }
224         
225         @Test
226         public void unt_thumbnailTest(){
227                 byte[] defaultValue={1,2,3};
228                 centralApp.setThumbnail(defaultValue);
229                 assertEquals(defaultValue, centralApp.getThumbnail());
230         }
231         
232         @Test
233         public void unt_userNameTest(){
234                 String defaultValue="Testusername";
235                 centralApp.setUsername(defaultValue);
236                 assertEquals(defaultValue, centralApp.getUsername());
237         }
238         
239         @Test
240         public void unt_uebKeyTest(){
241                 String defaultValue="Testuebkey";
242                 centralApp.setUebKey(defaultValue);
243                 assertEquals(defaultValue, centralApp.getUebKey());
244         }
245         
246         @Test
247         public void unt_uebSecreteTest(){
248                 String defaultValue="Testuebscrete";
249                 centralApp.setUebSecret(defaultValue);
250                 assertEquals(defaultValue, centralApp.getUebSecret());
251         }
252         
253         @Test
254         public void unt_uebTopicNameTest(){
255                 String defaultValue="Testuebtopicname";
256                 centralApp.setUebTopicName(defaultValue);
257                 assertEquals(defaultValue, centralApp.getUebTopicName());
258         }
259         
260         @Test
261         public void unt_hashCodeWithNullTest(){
262                 CentralApp centralApp=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
263                 
264                 CentralApp centralApp1=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
265
266                 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
267                 assertTrue(centralApp.equals(centralApp1));
268                 
269         }
270         
271         @Test
272         public void unt_hashCodeTest(){
273                 CentralApp centralApp=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
274                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
275                 
276                 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
277                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
278
279                 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
280                 assertTrue(centralApp.equals(centralApp1));
281                 
282         }
283         
284         @Test
285         public void unt_hashCodeTestWithNull(){
286                 CentralApp centralApp=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
287                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
288                 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
289                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
290                 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
291                 assertFalse(centralApp.equals(null));
292                 
293         }
294         
295         @Test
296         public void unt_hashCodeTestWithNull1(){
297                 CentralApp centralApp=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
298                 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
299                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
300                 assertFalse(centralApp.equals(centralApp1));
301                 
302         }
303         
304         @Test
305         public void unt_hashCodeTestWithalternateURL(){
306                 CentralApp centralApp=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, "test1", null, null, null, null, null, null, null, null, null, null, null, null);
307                 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
308                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
309                 assertFalse(centralApp.equals(centralApp1));
310                 
311         }
312         
313         @Test
314         public void unt_hashCodeTestWithpassword(){
315                 CentralApp centralApp=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, "test", null, null, null, null, "testPass", null, null, null, null, null, null, null);
316                 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
317                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
318                 assertFalse(centralApp.equals(centralApp1));
319                 
320         }
321         
322         @Test
323         public void unt_hashCodeTestWithcreateId(){
324                 CentralApp centralApp=new CentralApp(null, null, null, 123L, null, null, null, null, null, null, null, "test", null, null, null, null, "test", null, null, null, null, null, null, null);
325                 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
326                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
327                 assertFalse(centralApp.equals(centralApp1));
328                 
329         }
330         
331         @Test
332         public void unt_hashCodeTestWithcreateId1(){
333                 CentralApp centralApp=new CentralApp(12L, null, null, 123L, 123L, 123L, "test1", "test1", "test1", "test1", "test1", "test", "tests1", "test1", "test1", null, "test", null, null, null, null, null, null, null);
334                 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
335                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
336                 assertFalse(centralApp.equals(centralApp1));
337                 
338         }
339 }