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