Merge "Reorder modifiers"
[so.git] / mso-api-handlers / mso-api-handler-infra / src / test / java / org / openecomp / mso / apihandlerinfra / taskbeans / TaskListTest.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP - SO\r
4  * ================================================================================\r
5  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package org.openecomp.mso.apihandlerinfra.taskbeans;\r
22 \r
23 import org.junit.After;\r
24 \r
25 import static org.junit.Assert.assertEquals;\r
26 import org.junit.Before;\r
27 import org.junit.Test;\r
28 import static org.mockito.Mockito.mock;\r
29 import static org.mockito.Mockito.verify;\r
30 import static org.mockito.Mockito.when;\r
31 import org.json.JSONArray;\r
32 import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskList;\r
33 \r
34 public class TaskListTest {\r
35 \r
36         TaskList _taskList;\r
37         protected String _taskId;\r
38         protected String _type;\r
39         protected String _nfRole;\r
40         protected String _subscriptionServiceType;\r
41         protected String _originalRequestId;\r
42         protected String _originalRequestorId;\r
43         protected String _errorSource;\r
44         protected String _errorCode;\r
45         protected String _errorMessage;\r
46         protected String _buildingBlockName;\r
47         protected String _buildingBlockStep;\r
48         protected JSONArray _validResponses;\r
49 \r
50         public TaskListTest() {\r
51         }\r
52 \r
53         @Before\r
54         public void setUp() {\r
55                 _taskList = mock(TaskList.class);\r
56                 _taskId = "_taskid";\r
57                 _type = "type";\r
58                 _nfRole = "nfrole";\r
59                 _subscriptionServiceType = "subscriptionservicetype";\r
60                 _originalRequestId = "originalrequestid";\r
61                 _originalRequestorId = "originalrequestorid";\r
62                 _errorSource = "errorsource";\r
63                 _errorCode = "errorcode";\r
64                 _errorMessage = "errormessage";\r
65                 _buildingBlockName = "buildingblockname";\r
66                 _buildingBlockStep = "buildingblockstep";\r
67                 _validResponses = mock(JSONArray.class);\r
68 \r
69                 when(_taskList.getTaskId()).thenReturn(_taskId);\r
70                 when(_taskList.getType()).thenReturn(_type);\r
71                 when(_taskList.getNfRole()).thenReturn(_nfRole);\r
72                 when(_taskList.getSubscriptionServiceType()).thenReturn(_subscriptionServiceType);\r
73                 when(_taskList.getOriginalRequestId()).thenReturn(_originalRequestId);\r
74                 when(_taskList.getOriginalRequestorId()).thenReturn(_originalRequestorId);\r
75                 when(_taskList.getErrorSource()).thenReturn(_errorSource);\r
76                 when(_taskList.getErrorCode()).thenReturn(_errorCode);\r
77                 when(_taskList.getErrorMessage()).thenReturn(_errorMessage);\r
78                 when(_taskList.getBuildingBlockName()).thenReturn(_buildingBlockName);\r
79                 when(_taskList.getBuildingBlockStep()).thenReturn(_buildingBlockStep);\r
80                 when(_taskList.getValidResponses()).thenReturn(_validResponses);\r
81         }\r
82 \r
83         @After\r
84         public void tearDown() {\r
85                 _taskList = null;\r
86                 _validResponses = null;\r
87         }\r
88 \r
89         @Test\r
90         public void testGetTaskId() {\r
91                 String result = _taskList.getTaskId();\r
92                 assertEquals(_taskId, result);\r
93 \r
94         }\r
95 \r
96         @Test\r
97         public void testSetTaskId() {\r
98                 _taskList.setTaskId("_taskid");\r
99                 verify(_taskList).setTaskId(_taskId);\r
100         }\r
101 \r
102         @Test\r
103         public void testGetType() {\r
104                 String result = _taskList.getType();\r
105                 assertEquals(_type, result);\r
106 \r
107         }\r
108 \r
109         @Test\r
110         public void testSetType() {\r
111                 _taskList.setType(_type);\r
112                 verify(_taskList).setType(_type);\r
113         }\r
114 \r
115         @Test\r
116         public void testGetNfRole() {\r
117                 String result = _taskList.getNfRole();\r
118                 assertEquals(_nfRole, result);\r
119 \r
120         }\r
121 \r
122         @Test\r
123         public void testSetNfRole() {\r
124                 _taskList.setType(_nfRole);\r
125                 verify(_taskList).setType(_nfRole);\r
126         }\r
127 \r
128         @Test\r
129         public void testGetSubscriptionServiceType() {\r
130                 String result = _taskList.getSubscriptionServiceType();\r
131                 assertEquals(_subscriptionServiceType, result);\r
132 \r
133         }\r
134 \r
135         @Test\r
136         public void testSetSubscriptionServiceType() {\r
137                 _taskList.setSubscriptionServiceType(_subscriptionServiceType);\r
138                 verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType);\r
139         }\r
140 \r
141         @Test\r
142         public void testGetOriginalRequestId() {\r
143                 String result = _taskList.getOriginalRequestId();\r
144                 assertEquals(_originalRequestId, result);\r
145 \r
146         }\r
147 \r
148         @Test\r
149         public void testSetOriginalRequestId() {\r
150                 _taskList.setOriginalRequestId(_originalRequestId);\r
151                 verify(_taskList).setOriginalRequestId(_originalRequestId);\r
152         }\r
153 \r
154         @Test\r
155         public void testGetOriginalRequestorId() {\r
156                 String result = _taskList.getOriginalRequestorId();\r
157                 assertEquals(_originalRequestorId, result);\r
158 \r
159         }\r
160 \r
161         @Test\r
162         public void testSetOriginalRequestorId() {\r
163                 _taskList.setOriginalRequestorId(_originalRequestorId);\r
164                 verify(_taskList).setOriginalRequestorId(_originalRequestorId);\r
165         }\r
166 \r
167         @Test\r
168         public void testGetErrorSource() {\r
169                 String result = _taskList.getErrorSource();\r
170                 assertEquals(_errorSource, result);\r
171 \r
172         }\r
173 \r
174         @Test\r
175         public void testSetErrorSource() {\r
176                 _taskList.setErrorSource(_errorSource);\r
177                 verify(_taskList).setErrorSource(_errorSource);\r
178         }\r
179 \r
180         @Test\r
181         public void testGetErrorCode() {\r
182                 String result = _taskList.getErrorCode();\r
183                 assertEquals(_errorCode, result);\r
184 \r
185         }\r
186 \r
187         @Test\r
188         public void testSetErrorCode() {\r
189                 _taskList.setErrorCode(_errorCode);\r
190                 verify(_taskList).setErrorCode(_errorCode);\r
191         }\r
192 \r
193         @Test\r
194         public void testGetErrorMessage() {\r
195                 String result = _taskList.getErrorMessage();\r
196                 assertEquals(_errorMessage, result);\r
197 \r
198         }\r
199 \r
200         @Test\r
201         public void testSetErrorMessage() {\r
202                 _taskList.setErrorMessage(_errorMessage);\r
203                 verify(_taskList).setErrorMessage(_errorMessage);\r
204         }\r
205 \r
206         @Test\r
207         public void testGetBuildingBlockName() {\r
208                 String result = _taskList.getBuildingBlockName();\r
209                 assertEquals(_buildingBlockName, result);\r
210 \r
211         }\r
212 \r
213         @Test\r
214         public void testSetBuildingBlockName() {\r
215                 _taskList.setBuildingBlockName(_buildingBlockName);\r
216                 verify(_taskList).setBuildingBlockName(_buildingBlockName);\r
217         }\r
218 \r
219         @Test\r
220         public void testGetBuildingBlockStep() {\r
221                 String result = _taskList.getBuildingBlockStep();\r
222                 assertEquals(_buildingBlockStep, result);\r
223 \r
224         }\r
225 \r
226         @Test\r
227         public void testSetBuildingBlockStep() {\r
228                 _taskList.setBuildingBlockStep(_buildingBlockStep);\r
229                 verify(_taskList).setBuildingBlockStep(_buildingBlockStep);\r
230         }\r
231 \r
232         @Test\r
233         public void testGetValidResponses() {\r
234 \r
235                 JSONArray result = _taskList.getValidResponses();\r
236                 assertEquals(_validResponses, result);\r
237 \r
238         }\r
239         \r
240         @Test\r
241         public void testSetValidResponses() {\r
242                 _taskList.setValidResponses(_validResponses);\r
243                 verify(_taskList).setValidResponses(_validResponses);\r
244         }\r
245 \r
246 \r
247 }\r