2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (C) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.std.test;
25 import java.util.Hashtable;
28 import org.onap.policy.api.PolicyResponseStatus;
29 import org.onap.policy.std.StdPolicyResponse;
30 import static org.junit.Assert.*;
33 * The class <code>StdPolicyResponseTest</code> contains tests for the class
34 * <code>{@link StdPolicyResponse}</code>.
36 * @generatedBy CodePro at 6/1/16 1:40 PM
37 * @version $Revision: 1.0 $
39 public class StdPolicyResponseTest {
41 * Run the Map<String, String> getActionAdvised() method test.
45 * @generatedBy CodePro at 6/1/16 1:40 PM
48 public void testGetActionAdvised_1() throws Exception {
49 StdPolicyResponse fixture = new StdPolicyResponse();
50 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
51 fixture.setRequestAttributes(new Hashtable<String, String>());
52 fixture.setActionAdvised(new Hashtable<String, String>());
53 fixture.setActionTaken(new Hashtable<String, String>());
55 Map<String, String> result = fixture.getActionAdvised();
57 // add additional test code here
58 assertNotNull(result);
59 assertEquals(0, result.size());
63 * Run the Map<String, String> getActionTaken() method test.
67 * @generatedBy CodePro at 6/1/16 1:40 PM
70 public void testGetActionTaken_1() throws Exception {
71 StdPolicyResponse fixture = new StdPolicyResponse();
72 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
73 fixture.setRequestAttributes(new Hashtable<String, String>());
74 fixture.setActionAdvised(new Hashtable<String, String>());
75 fixture.setActionTaken(new Hashtable<String, String>());
77 Map<String, String> result = fixture.getActionTaken();
79 // add additional test code here
80 assertNotNull(result);
81 assertEquals(0, result.size());
85 * Run the String getPolicyResponseMessage() method test.
89 * @generatedBy CodePro at 6/1/16 1:40 PM
92 public void testGetPolicyResponseMessage_1() throws Exception {
93 StdPolicyResponse fixture = new StdPolicyResponse();
94 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
95 fixture.setRequestAttributes(new Hashtable<String, String>());
96 fixture.setActionAdvised(new Hashtable<String, String>());
97 fixture.setActionTaken(new Hashtable<String, String>());
99 String result = fixture.getPolicyResponseMessage();
101 // add additional test code here
102 assertEquals("", result);
106 * Run the PolicyResponseStatus getPolicyResponseStatus() method test.
110 * @generatedBy CodePro at 6/1/16 1:40 PM
113 public void testGetPolicyResponseStatus_1() throws Exception {
114 StdPolicyResponse fixture = new StdPolicyResponse();
115 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
116 fixture.setRequestAttributes(new Hashtable<String, String>());
117 fixture.setActionAdvised(new Hashtable<String, String>());
118 fixture.setActionTaken(new Hashtable<String, String>());
120 PolicyResponseStatus result = fixture.getPolicyResponseStatus();
122 // add additional test code here
123 assertNotNull(result);
124 assertEquals("action_advised", result.toString());
125 assertEquals("ACTION_ADVISED", result.name());
126 assertEquals(1, result.ordinal());
130 * Run the Map<String, String> getRequestAttributes() method test.
134 * @generatedBy CodePro at 6/1/16 1:40 PM
137 public void testGetRequestAttributes_1() throws Exception {
138 StdPolicyResponse fixture = new StdPolicyResponse();
139 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
140 fixture.setRequestAttributes(new Hashtable<String, String>());
141 fixture.setActionAdvised(new Hashtable<String, String>());
142 fixture.setActionTaken(new Hashtable<String, String>());
144 Map<String, String> result = fixture.getRequestAttributes();
146 // add additional test code here
147 assertNotNull(result);
148 assertEquals(0, result.size());
152 * Run the void setActionAdvised(Map<String,String>) method test.
156 * @generatedBy CodePro at 6/1/16 1:40 PM
159 public void testSetActionAdvised_1() throws Exception {
160 StdPolicyResponse fixture = new StdPolicyResponse();
161 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
162 fixture.setRequestAttributes(new Hashtable<String, String>());
163 fixture.setActionAdvised(new Hashtable<String, String>());
164 fixture.setActionTaken(new Hashtable<String, String>());
165 Map<String, String> actionAdvised = new Hashtable<String, String>();
167 fixture.setActionAdvised(actionAdvised);
169 // add additional test code here
173 * Run the void setActionTaken(Map<String,String>) method test.
177 * @generatedBy CodePro at 6/1/16 1:40 PM
180 public void testSetActionTaken_1() throws Exception {
181 StdPolicyResponse fixture = new StdPolicyResponse();
182 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
183 fixture.setRequestAttributes(new Hashtable<String, String>());
184 fixture.setActionAdvised(new Hashtable<String, String>());
185 fixture.setActionTaken(new Hashtable<String, String>());
186 Map<String, String> actionTaken = new Hashtable<String, String>();
188 fixture.setActionTaken(actionTaken);
190 // add additional test code here
194 * Run the void setPolicyResponseMessage(String) method test.
198 * @generatedBy CodePro at 6/1/16 1:40 PM
201 public void testSetPolicyResponseMessage_1() throws Exception {
202 StdPolicyResponse fixture = new StdPolicyResponse();
203 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
204 fixture.setRequestAttributes(new Hashtable<String, String>());
205 fixture.setActionAdvised(new Hashtable<String, String>());
206 fixture.setActionTaken(new Hashtable<String, String>());
207 String policyResponseMessage = "";
209 fixture.setPolicyResponseMessage(policyResponseMessage);
211 // add additional test code here
215 * Run the void setPolicyResponseStatus(PolicyResponseStatus) method test.
219 * @generatedBy CodePro at 6/1/16 1:40 PM
222 public void testSetPolicyResponseStatus_1() throws Exception {
223 StdPolicyResponse fixture = new StdPolicyResponse();
224 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
225 fixture.setRequestAttributes(new Hashtable<String, String>());
226 fixture.setActionAdvised(new Hashtable<String, String>());
227 fixture.setActionTaken(new Hashtable<String, String>());
228 PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
230 fixture.setPolicyResponseStatus(policyResponseStatus);
232 // add additional test code here
236 * Run the void setPolicyResponseStatus(String,PolicyResponseStatus) method test.
240 * @generatedBy CodePro at 6/1/16 1:40 PM
243 public void testSetPolicyResponseStatus_2() throws Exception {
244 StdPolicyResponse fixture = new StdPolicyResponse();
245 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
246 fixture.setRequestAttributes(new Hashtable<String, String>());
247 fixture.setActionAdvised(new Hashtable<String, String>());
248 fixture.setActionTaken(new Hashtable<String, String>());
249 String policyResponseMessage = "";
250 PolicyResponseStatus policyResponseStatus = PolicyResponseStatus.ACTION_ADVISED;
252 fixture.setPolicyResponseStatus(policyResponseMessage, policyResponseStatus);
254 // add additional test code here
258 * Run the void setRequestAttributes(Map<String,String>) method test.
262 * @generatedBy CodePro at 6/1/16 1:40 PM
265 public void testSetRequestAttributes_1() throws Exception {
266 StdPolicyResponse fixture = new StdPolicyResponse();
267 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
268 fixture.setRequestAttributes(new Hashtable<String, String>());
269 fixture.setActionAdvised(new Hashtable<String, String>());
270 fixture.setActionTaken(new Hashtable<String, String>());
271 Map<String, String> requestAttributes = new Hashtable<String, String>();
273 fixture.setRequestAttributes(requestAttributes);
275 // add additional test code here
279 * Run the String toString() method test.
283 * @generatedBy CodePro at 6/1/16 1:40 PM
286 public void testToString_1() throws Exception {
287 StdPolicyResponse fixture = new StdPolicyResponse();
288 fixture.setPolicyResponseStatus("", PolicyResponseStatus.ACTION_ADVISED);
289 fixture.setRequestAttributes(new Hashtable<String, String>());
290 fixture.setActionAdvised(new Hashtable<String, String>());
291 fixture.setActionTaken(new Hashtable<String, String>());
293 String result = fixture.toString();
295 // add additional test code here
297 "PolicyResponse [ policyResponseStatus=action_advised, policyResponseMessage=, ]",
302 * Perform pre-test initialization.
304 * @throws Exception if the initialization fails for some reason
306 * @generatedBy CodePro at 6/1/16 1:40 PM
309 public void setUp() throws Exception {
310 // add additional set up code here
314 * Perform post-test clean-up.
316 * @throws Exception if the clean-up fails for some reason
318 * @generatedBy CodePro at 6/1/16 1:40 PM
321 public void tearDown() throws Exception {
322 // Add additional tear down code here
328 * @param args the command line arguments
330 * @generatedBy CodePro at 6/1/16 1:40 PM
332 public static void main(String[] args) {
333 new org.junit.runner.JUnitCore().run(StdPolicyResponseTest.class);