2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. 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.policy.test;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.onap.policy.api.PolicyResponseStatus;
32 * The class <code>PolicyResponseStatusTest</code> contains tests for the class
33 * <code>{@link PolicyResponseStatus}</code>.
35 * @generatedBy CodePro at 6/1/16 1:41 PM
36 * @version $Revision: 1.0 $
38 public class PolicyResponseStatusTest {
40 * Run the PolicyResponseStatus getStatus(String) method test.
44 * @generatedBy CodePro at 6/1/16 1:41 PM
47 public void testGetStatus_1() throws Exception {
48 final String responseStatus = "";
50 final PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
52 // add additional test code here
53 assertNotNull(result);
54 assertEquals("no_action", result.toString());
55 assertEquals("NO_ACTION_REQUIRED", result.name());
56 assertEquals(0, result.ordinal());
60 public void testCreate_EnumName_PolicyResponseStatusEnum() {
61 for (final PolicyResponseStatus policyResponseStatus : PolicyResponseStatus.values()) {
62 final PolicyResponseStatus actualPolicyResponseStatus = PolicyResponseStatus
63 .create(policyResponseStatus.name());
64 assertEquals(policyResponseStatus, actualPolicyResponseStatus);
65 assertEquals(policyResponseStatus.toString(), actualPolicyResponseStatus.toString());
70 public void testCreate_StringValue_PolicyResponseStatusEnum() {
71 for (final PolicyResponseStatus policyResponseStatus : PolicyResponseStatus.values()) {
72 final PolicyResponseStatus actualPolicyResponseStatus = PolicyResponseStatus
73 .create(policyResponseStatus.toString());
74 assertEquals(policyResponseStatus, actualPolicyResponseStatus);
79 * Run the PolicyResponseStatus getStatus(String) method test.
83 * @generatedBy CodePro at 6/1/16 1:41 PM
86 public void testGetStatus_2() throws Exception {
87 final String responseStatus = "action_advised";
89 final PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
91 // add additional test code here
92 assertNotNull(result);
93 assertEquals("action_advised", result.toString());
94 assertEquals("ACTION_ADVISED", result.name());
95 assertEquals(1, result.ordinal());
99 * Run the PolicyResponseStatus getStatus(String) method test.
103 * @generatedBy CodePro at 6/1/16 1:41 PM
106 public void testGetStatus_3() throws Exception {
107 final String responseStatus = "action_taken";
109 final PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
111 // add additional test code here
112 assertNotNull(result);
113 assertEquals("action_taken", result.toString());
114 assertEquals("ACTION_TAKEN", result.name());
115 assertEquals(2, result.ordinal());
119 * Run the String toString() method test.
123 * @generatedBy CodePro at 6/1/16 1:41 PM
126 public void testToString_1() throws Exception {
127 final PolicyResponseStatus fixture = PolicyResponseStatus.ACTION_ADVISED;
129 final String result = fixture.toString();
131 // add additional test code here
132 assertEquals("action_advised", result);
134 assertEquals(PolicyResponseStatus.ACTION_ADVISED, PolicyResponseStatus.create("ACTION_ADVISED"));
137 @Test(expected = IllegalArgumentException.class)
138 public void testTheRest() {
139 PolicyResponseStatus.create("foobar");
143 * Perform pre-test initialization.
146 * if the initialization fails for some reason
148 * @generatedBy CodePro at 6/1/16 1:41 PM
151 public void setUp() throws Exception {
152 // add additional set up code here
156 * Perform post-test clean-up.
159 * if the clean-up fails for some reason
161 * @generatedBy CodePro at 6/1/16 1:41 PM
164 public void tearDown() throws Exception {
165 // Add additional tear down code here
172 * the command line arguments
174 * @generatedBy CodePro at 6/1/16 1:41 PM
176 public static void main(final String[] args) {
177 new org.junit.runner.JUnitCore().run(PolicyResponseStatusTest.class);