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
27 import org.junit.Before;
\r
28 import org.junit.Test;
\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
34 import org.json.JSONArray;
\r
35 import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskList;
\r
37 public class TaskListTest {
\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
53 public TaskListTest() {
\r
57 public void setUp() {
\r
58 _taskList = mock(TaskList.class);
\r
59 _taskId = "_taskid";
\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
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
87 public void tearDown() {
\r
89 _validResponses = null;
\r
93 public void testGetTaskId() {
\r
94 String result = _taskList.getTaskId();
\r
95 assertEquals(_taskId, result);
\r
100 public void testSetTaskId() {
\r
101 _taskList.setTaskId("_taskid");
\r
102 verify(_taskList).setTaskId(_taskId);
\r
106 public void testGetType() {
\r
107 String result = _taskList.getType();
\r
108 assertEquals(_type, result);
\r
113 public void testSetType() {
\r
114 _taskList.setType(_type);
\r
115 verify(_taskList).setType(_type);
\r
119 public void testGetNfRole() {
\r
120 String result = _taskList.getNfRole();
\r
121 assertEquals(_nfRole, result);
\r
126 public void testSetNfRole() {
\r
127 _taskList.setType(_nfRole);
\r
128 verify(_taskList).setType(_nfRole);
\r
132 public void testGetSubscriptionServiceType() {
\r
133 String result = _taskList.getSubscriptionServiceType();
\r
134 assertEquals(_subscriptionServiceType, result);
\r
139 public void testSetSubscriptionServiceType() {
\r
140 _taskList.setSubscriptionServiceType(_subscriptionServiceType);
\r
141 verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType);
\r
145 public void testGetOriginalRequestId() {
\r
146 String result = _taskList.getOriginalRequestId();
\r
147 assertEquals(_originalRequestId, result);
\r
152 public void testSetOriginalRequestId() {
\r
153 _taskList.setOriginalRequestId(_originalRequestId);
\r
154 verify(_taskList).setOriginalRequestId(_originalRequestId);
\r
158 public void testGetOriginalRequestorId() {
\r
159 String result = _taskList.getOriginalRequestorId();
\r
160 assertEquals(_originalRequestorId, result);
\r
165 public void testSetOriginalRequestorId() {
\r
166 _taskList.setOriginalRequestorId(_originalRequestorId);
\r
167 verify(_taskList).setOriginalRequestorId(_originalRequestorId);
\r
171 public void testGetErrorSource() {
\r
172 String result = _taskList.getErrorSource();
\r
173 assertEquals(_errorSource, result);
\r
178 public void testSetErrorSource() {
\r
179 _taskList.setErrorSource(_errorSource);
\r
180 verify(_taskList).setErrorSource(_errorSource);
\r
184 public void testGetErrorCode() {
\r
185 String result = _taskList.getErrorCode();
\r
186 assertEquals(_errorCode, result);
\r
191 public void testSetErrorCode() {
\r
192 _taskList.setErrorCode(_errorCode);
\r
193 verify(_taskList).setErrorCode(_errorCode);
\r
197 public void testGetErrorMessage() {
\r
198 String result = _taskList.getErrorMessage();
\r
199 assertEquals(_errorMessage, result);
\r
204 public void testSetErrorMessage() {
\r
205 _taskList.setErrorMessage(_errorMessage);
\r
206 verify(_taskList).setErrorMessage(_errorMessage);
\r
210 public void testGetBuildingBlockName() {
\r
211 String result = _taskList.getBuildingBlockName();
\r
212 assertEquals(_buildingBlockName, result);
\r
217 public void testSetBuildingBlockName() {
\r
218 _taskList.setBuildingBlockName(_buildingBlockName);
\r
219 verify(_taskList).setBuildingBlockName(_buildingBlockName);
\r
223 public void testGetBuildingBlockStep() {
\r
224 String result = _taskList.getBuildingBlockStep();
\r
225 assertEquals(_buildingBlockStep, result);
\r
230 public void testSetBuildingBlockStep() {
\r
231 _taskList.setBuildingBlockStep(_buildingBlockStep);
\r
232 verify(_taskList).setBuildingBlockStep(_buildingBlockStep);
\r
236 public void testGetValidResponses() {
\r
238 JSONArray result = _taskList.getValidResponses();
\r
239 assertEquals(_validResponses, result);
\r
244 public void testSetValidResponses() {
\r
245 _taskList.setValidResponses(_validResponses);
\r
246 verify(_taskList).setValidResponses(_validResponses);
\r