2 * ============LICENSE_START=======================================================
\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
11 * http://www.apache.org/licenses/LICENSE-2.0
\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
21 package org.openecomp.mso.apihandlerinfra.taskbeans;
\r
23 import org.junit.After;
\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
34 public class TaskListTest {
\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
50 public TaskListTest() {
\r
54 public void setUp() {
\r
55 _taskList = mock(TaskList.class);
\r
56 _taskId = "_taskid";
\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
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
84 public void tearDown() {
\r
86 _validResponses = null;
\r
90 public void testGetTaskId() {
\r
91 String result = _taskList.getTaskId();
\r
92 assertEquals(_taskId, result);
\r
97 public void testSetTaskId() {
\r
98 _taskList.setTaskId("_taskid");
\r
99 verify(_taskList).setTaskId(_taskId);
\r
103 public void testGetType() {
\r
104 String result = _taskList.getType();
\r
105 assertEquals(_type, result);
\r
110 public void testSetType() {
\r
111 _taskList.setType(_type);
\r
112 verify(_taskList).setType(_type);
\r
116 public void testGetNfRole() {
\r
117 String result = _taskList.getNfRole();
\r
118 assertEquals(_nfRole, result);
\r
123 public void testSetNfRole() {
\r
124 _taskList.setType(_nfRole);
\r
125 verify(_taskList).setType(_nfRole);
\r
129 public void testGetSubscriptionServiceType() {
\r
130 String result = _taskList.getSubscriptionServiceType();
\r
131 assertEquals(_subscriptionServiceType, result);
\r
136 public void testSetSubscriptionServiceType() {
\r
137 _taskList.setSubscriptionServiceType(_subscriptionServiceType);
\r
138 verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType);
\r
142 public void testGetOriginalRequestId() {
\r
143 String result = _taskList.getOriginalRequestId();
\r
144 assertEquals(_originalRequestId, result);
\r
149 public void testSetOriginalRequestId() {
\r
150 _taskList.setOriginalRequestId(_originalRequestId);
\r
151 verify(_taskList).setOriginalRequestId(_originalRequestId);
\r
155 public void testGetOriginalRequestorId() {
\r
156 String result = _taskList.getOriginalRequestorId();
\r
157 assertEquals(_originalRequestorId, result);
\r
162 public void testSetOriginalRequestorId() {
\r
163 _taskList.setOriginalRequestorId(_originalRequestorId);
\r
164 verify(_taskList).setOriginalRequestorId(_originalRequestorId);
\r
168 public void testGetErrorSource() {
\r
169 String result = _taskList.getErrorSource();
\r
170 assertEquals(_errorSource, result);
\r
175 public void testSetErrorSource() {
\r
176 _taskList.setErrorSource(_errorSource);
\r
177 verify(_taskList).setErrorSource(_errorSource);
\r
181 public void testGetErrorCode() {
\r
182 String result = _taskList.getErrorCode();
\r
183 assertEquals(_errorCode, result);
\r
188 public void testSetErrorCode() {
\r
189 _taskList.setErrorCode(_errorCode);
\r
190 verify(_taskList).setErrorCode(_errorCode);
\r
194 public void testGetErrorMessage() {
\r
195 String result = _taskList.getErrorMessage();
\r
196 assertEquals(_errorMessage, result);
\r
201 public void testSetErrorMessage() {
\r
202 _taskList.setErrorMessage(_errorMessage);
\r
203 verify(_taskList).setErrorMessage(_errorMessage);
\r
207 public void testGetBuildingBlockName() {
\r
208 String result = _taskList.getBuildingBlockName();
\r
209 assertEquals(_buildingBlockName, result);
\r
214 public void testSetBuildingBlockName() {
\r
215 _taskList.setBuildingBlockName(_buildingBlockName);
\r
216 verify(_taskList).setBuildingBlockName(_buildingBlockName);
\r
220 public void testGetBuildingBlockStep() {
\r
221 String result = _taskList.getBuildingBlockStep();
\r
222 assertEquals(_buildingBlockStep, result);
\r
227 public void testSetBuildingBlockStep() {
\r
228 _taskList.setBuildingBlockStep(_buildingBlockStep);
\r
229 verify(_taskList).setBuildingBlockStep(_buildingBlockStep);
\r
233 public void testGetValidResponses() {
\r
235 JSONArray result = _taskList.getValidResponses();
\r
236 assertEquals(_validResponses, result);
\r
241 public void testSetValidResponses() {
\r
242 _taskList.setValidResponses(_validResponses);
\r
243 verify(_taskList).setValidResponses(_validResponses);
\r