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