Reduce technical debt and add JUnit
[policy/engine.git] / PolicyEngineAPI / src / test / java / org / onap / policy / test / PolicyResponseStatusTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.policy.test;
22
23 import org.junit.*;
24 import org.onap.policy.api.PolicyResponseStatus;
25
26 import static org.junit.Assert.*;
27
28 /**
29  * The class <code>PolicyResponseStatusTest</code> contains tests for the class <code>{@link PolicyResponseStatus}</code>.
30  *
31  * @generatedBy CodePro at 6/1/16 1:41 PM
32  * @version $Revision: 1.0 $
33  */
34 public class PolicyResponseStatusTest {
35         /**
36          * Run the PolicyResponseStatus getStatus(String) method test.
37          *
38          * @throws Exception
39          *
40          * @generatedBy CodePro at 6/1/16 1:41 PM
41          */
42         @Test
43         public void testGetStatus_1()
44                 throws Exception {
45                 String responseStatus = "";
46
47                 PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
48
49                 // add additional test code here
50                 assertNotNull(result);
51                 assertEquals("no_action", result.toString());
52                 assertEquals("NO_ACTION_REQUIRED", result.name());
53                 assertEquals(0, result.ordinal());
54         }
55
56         /**
57          * Run the PolicyResponseStatus getStatus(String) method test.
58          *
59          * @throws Exception
60          *
61          * @generatedBy CodePro at 6/1/16 1:41 PM
62          */
63         @Test
64         public void testGetStatus_2()
65                 throws Exception {
66                 String responseStatus = "action_advised";
67
68                 PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
69
70                 // add additional test code here
71                 assertNotNull(result);
72                 assertEquals("action_advised", result.toString());
73                 assertEquals("ACTION_ADVISED", result.name());
74                 assertEquals(1, result.ordinal());
75         }
76
77         /**
78          * Run the PolicyResponseStatus getStatus(String) method test.
79          *
80          * @throws Exception
81          *
82          * @generatedBy CodePro at 6/1/16 1:41 PM
83          */
84         @Test
85         public void testGetStatus_3()
86                 throws Exception {
87                 String responseStatus = "action_taken";
88
89                 PolicyResponseStatus result = PolicyResponseStatus.getStatus(responseStatus);
90
91                 // add additional test code here
92                 assertNotNull(result);
93                 assertEquals("action_taken", result.toString());
94                 assertEquals("ACTION_TAKEN", result.name());
95                 assertEquals(2, result.ordinal());
96         }
97
98         /**
99          * Run the String toString() method test.
100          *
101          * @throws Exception
102          *
103          * @generatedBy CodePro at 6/1/16 1:41 PM
104          */
105         @Test
106         public void testToString_1()
107                 throws Exception {
108                 PolicyResponseStatus fixture = PolicyResponseStatus.ACTION_ADVISED;
109
110                 String result = fixture.toString();
111
112                 // add additional test code here
113                 assertEquals("action_advised", result);
114
115                 assertEquals(PolicyResponseStatus.ACTION_ADVISED, PolicyResponseStatus.create("ACTION_ADVISED"));
116         }
117         
118         @Test(expected = IllegalArgumentException.class)
119         public void testTheRest() {
120                 PolicyResponseStatus.create("foobar");
121         }
122
123         /**
124          * Perform pre-test initialization.
125          *
126          * @throws Exception
127          *         if the initialization fails for some reason
128          *
129          * @generatedBy CodePro at 6/1/16 1:41 PM
130          */
131         @Before
132         public void setUp()
133                 throws Exception {
134                 // add additional set up code here
135         }
136
137         /**
138          * Perform post-test clean-up.
139          *
140          * @throws Exception
141          *         if the clean-up fails for some reason
142          *
143          * @generatedBy CodePro at 6/1/16 1:41 PM
144          */
145         @After
146         public void tearDown()
147                 throws Exception {
148                 // Add additional tear down code here
149         }
150
151         /**
152          * Launch the test.
153          *
154          * @param args the command line arguments
155          *
156          * @generatedBy CodePro at 6/1/16 1:41 PM
157          */
158         public static void main(String[] args) {
159                 new org.junit.runner.JUnitCore().run(PolicyResponseStatusTest.class);
160         }
161 }