Merge "Included Policy GUI Enhancements and validations"
[policy/engine.git] / PolicyEngineAPI / src / test / java / org / onap / policy / test / PolicyConfigStatusTest.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.PolicyConfigStatus;
25
26 import static org.junit.Assert.*;
27
28 /**
29  * The class <code>PolicyConfigStatusTest</code> contains tests for the class <code>{@link PolicyConfigStatus}</code>.
30  *
31  * @generatedBy CodePro at 6/1/16 1:41 PM
32  * @version $Revision: 1.0 $
33  */
34 public class PolicyConfigStatusTest {
35         /**
36          * Run the PolicyConfigStatus 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 configStatus = "";
46
47                 PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus);
48
49                 // add additional test code here
50                 assertNotNull(result);
51                 assertEquals("not_found", result.toString());
52                 assertEquals("CONFIG_NOT_FOUND", result.name());
53                 assertEquals(1, result.ordinal());
54                 
55                 assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, PolicyConfigStatus.create("retrieved"));
56         }
57
58         /**
59          * Run the PolicyConfigStatus getStatus(String) method test.
60          *
61          * @throws Exception
62          *
63          * @generatedBy CodePro at 6/1/16 1:41 PM
64          */
65         @Test
66         public void testGetStatus_2()
67                 throws Exception {
68                 String configStatus = "retrieved";
69
70                 PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus);
71
72                 // add additional test code here
73                 assertNotNull(result);
74                 assertEquals("retrieved", result.toString());
75                 assertEquals("CONFIG_RETRIEVED", result.name());
76                 assertEquals(0, result.ordinal());
77         }
78
79         /**
80          * Run the String toString() method test.
81          *
82          * @throws Exception
83          *
84          * @generatedBy CodePro at 6/1/16 1:41 PM
85          */
86         @Test
87         public void testToString_1()
88                 throws Exception {
89                 PolicyConfigStatus fixture = PolicyConfigStatus.CONFIG_NOT_FOUND;
90
91                 String result = fixture.toString();
92
93                 // add additional test code here
94                 assertEquals("not_found", result);
95         }
96
97         @Test(expected = IllegalArgumentException.class)
98         public void testException () {
99                 PolicyConfigStatus.create("foobar");
100         }
101         /**
102          * Perform pre-test initialization.
103          *
104          * @throws Exception
105          *         if the initialization fails for some reason
106          *
107          * @generatedBy CodePro at 6/1/16 1:41 PM
108          */
109         @Before
110         public void setUp()
111                 throws Exception {
112                 // add additional set up code here
113         }
114
115         /**
116          * Perform post-test clean-up.
117          *
118          * @throws Exception
119          *         if the clean-up fails for some reason
120          *
121          * @generatedBy CodePro at 6/1/16 1:41 PM
122          */
123         @After
124         public void tearDown()
125                 throws Exception {
126                 // Add additional tear down code here
127         }
128
129         /**
130          * Launch the test.
131          *
132          * @param args the command line arguments
133          *
134          * @generatedBy CodePro at 6/1/16 1:41 PM
135          */
136         public static void main(String[] args) {
137                 new org.junit.runner.JUnitCore().run(PolicyConfigStatusTest.class);
138         }
139 }