10/31: merge casablanca to master
[so.git] / mso-api-handlers / mso-api-handler-infra / src / test / java / org / onap / so / apihandlerinfra / tasksbeans / TaskListTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
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
21 package org.onap.so.apihandlerinfra.tasksbeans;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.mockito.Mockito.mock;
25 import static org.mockito.Mockito.verify;
26 import static org.mockito.Mockito.when;
27
28 import java.util.List;
29
30 import org.junit.After;
31 import org.junit.Before;
32 import org.junit.Test;
33
34 public class TaskListTest {
35
36         TaskList _taskList;
37         protected String _taskId;
38         protected String _type;
39         protected String _nfRole;
40         protected String _subscriptionServiceType;
41         protected String _originalRequestId;
42         protected String _originalRequestorId;
43         protected String _errorSource;
44         protected String _errorCode;
45         protected String _errorMessage;
46         protected String _buildingBlockName;
47         protected String _buildingBlockStep;
48         protected List<String> _validResponses;
49
50         public TaskListTest() {
51         }
52
53         @Before
54         public void setUp() {
55                 _taskList = mock(TaskList.class);
56                 _taskId = "_taskid";
57                 _type = "type";
58                 _nfRole = "nfrole";
59                 _subscriptionServiceType = "subscriptionservicetype";
60                 _originalRequestId = "originalrequestid";
61                 _originalRequestorId = "originalrequestorid";
62                 _errorSource = "errorsource";
63                 _errorCode = "errorcode";
64                 _errorMessage = "errormessage";
65                 _buildingBlockName = "buildingblockname";
66                 _buildingBlockStep = "buildingblockstep";
67                 _validResponses = mock(List.class);
68
69                 when(_taskList.getTaskId()).thenReturn(_taskId);
70                 when(_taskList.getType()).thenReturn(_type);
71                 when(_taskList.getNfRole()).thenReturn(_nfRole);
72                 when(_taskList.getSubscriptionServiceType()).thenReturn(_subscriptionServiceType);
73                 when(_taskList.getOriginalRequestId()).thenReturn(_originalRequestId);
74                 when(_taskList.getOriginalRequestorId()).thenReturn(_originalRequestorId);
75                 when(_taskList.getErrorSource()).thenReturn(_errorSource);
76                 when(_taskList.getErrorCode()).thenReturn(_errorCode);
77                 when(_taskList.getErrorMessage()).thenReturn(_errorMessage);
78                 when(_taskList.getBuildingBlockName()).thenReturn(_buildingBlockName);
79                 when(_taskList.getBuildingBlockStep()).thenReturn(_buildingBlockStep);
80                 when(_taskList.getValidResponses()).thenReturn(_validResponses);
81         }
82
83         @After
84         public void tearDown() {
85                 _taskList = null;
86                 _validResponses = null;
87         }
88
89         @Test
90         public void testGetTaskId() {
91                 String result = _taskList.getTaskId();
92                 assertEquals(_taskId, result);
93
94         }
95
96         @Test
97         public void testSetTaskId() {
98                 _taskList.setTaskId("_taskid");
99                 verify(_taskList).setTaskId(_taskId);
100         }
101
102         @Test
103         public void testGetType() {
104                 String result = _taskList.getType();
105                 assertEquals(_type, result);
106
107         }
108
109         @Test
110         public void testSetType() {
111                 _taskList.setType(_type);
112                 verify(_taskList).setType(_type);
113         }
114
115         @Test
116         public void testGetNfRole() {
117                 String result = _taskList.getNfRole();
118                 assertEquals(_nfRole, result);
119
120         }
121
122         @Test
123         public void testSetNfRole() {
124                 _taskList.setType(_nfRole);
125                 verify(_taskList).setType(_nfRole);
126         }
127
128         @Test
129         public void testGetSubscriptionServiceType() {
130                 String result = _taskList.getSubscriptionServiceType();
131                 assertEquals(_subscriptionServiceType, result);
132
133         }
134
135         @Test
136         public void testSetSubscriptionServiceType() {
137                 _taskList.setSubscriptionServiceType(_subscriptionServiceType);
138                 verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType);
139         }
140
141         @Test
142         public void testGetOriginalRequestId() {
143                 String result = _taskList.getOriginalRequestId();
144                 assertEquals(_originalRequestId, result);
145
146         }
147
148         @Test
149         public void testSetOriginalRequestId() {
150                 _taskList.setOriginalRequestId(_originalRequestId);
151                 verify(_taskList).setOriginalRequestId(_originalRequestId);
152         }
153
154         @Test
155         public void testGetOriginalRequestorId() {
156                 String result = _taskList.getOriginalRequestorId();
157                 assertEquals(_originalRequestorId, result);
158
159         }
160
161         @Test
162         public void testSetOriginalRequestorId() {
163                 _taskList.setOriginalRequestorId(_originalRequestorId);
164                 verify(_taskList).setOriginalRequestorId(_originalRequestorId);
165         }
166
167         @Test
168         public void testGetErrorSource() {
169                 String result = _taskList.getErrorSource();
170                 assertEquals(_errorSource, result);
171
172         }
173
174         @Test
175         public void testSetErrorSource() {
176                 _taskList.setErrorSource(_errorSource);
177                 verify(_taskList).setErrorSource(_errorSource);
178         }
179
180         @Test
181         public void testGetErrorCode() {
182                 String result = _taskList.getErrorCode();
183                 assertEquals(_errorCode, result);
184
185         }
186
187         @Test
188         public void testSetErrorCode() {
189                 _taskList.setErrorCode(_errorCode);
190                 verify(_taskList).setErrorCode(_errorCode);
191         }
192
193         @Test
194         public void testGetErrorMessage() {
195                 String result = _taskList.getErrorMessage();
196                 assertEquals(_errorMessage, result);
197
198         }
199
200         @Test
201         public void testSetErrorMessage() {
202                 _taskList.setErrorMessage(_errorMessage);
203                 verify(_taskList).setErrorMessage(_errorMessage);
204         }
205
206         @Test
207         public void testGetBuildingBlockName() {
208                 String result = _taskList.getBuildingBlockName();
209                 assertEquals(_buildingBlockName, result);
210
211         }
212
213         @Test
214         public void testSetBuildingBlockName() {
215                 _taskList.setBuildingBlockName(_buildingBlockName);
216                 verify(_taskList).setBuildingBlockName(_buildingBlockName);
217         }
218
219         @Test
220         public void testGetBuildingBlockStep() {
221                 String result = _taskList.getBuildingBlockStep();
222                 assertEquals(_buildingBlockStep, result);
223
224         }
225
226         @Test
227         public void testSetBuildingBlockStep() {
228                 _taskList.setBuildingBlockStep(_buildingBlockStep);
229                 verify(_taskList).setBuildingBlockStep(_buildingBlockStep);
230         }
231
232         @Test
233         public void testGetValidResponses() {
234
235                 List<String> result = _taskList.getValidResponses();
236                 assertEquals(_validResponses, result);
237
238         }
239         
240         @Test
241         public void testSetValidResponses() {
242                 _taskList.setValidResponses(_validResponses);
243                 verify(_taskList).setValidResponses(_validResponses);
244         }
245
246
247 }