Remove useless imports and vars
[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 static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25
26 import org.junit.Test;
27 import org.onap.policy.api.PolicyConfigStatus;
28
29 /**
30  * The class <code>PolicyConfigStatusTest</code> contains tests for the class
31  * <code>{@link PolicyConfigStatus}</code>.
32  *
33  * @generatedBy CodePro at 6/1/16 1:41 PM
34  * @version $Revision: 1.0 $
35  */
36 public class PolicyConfigStatusTest {
37     /**
38      * Run the PolicyConfigStatus getStatus(String) method test.
39      *
40      * @throws Exception
41      *
42      * @generatedBy CodePro at 6/1/16 1:41 PM
43      */
44     @Test
45     public void testGetStatus_1() throws Exception {
46         final String configStatus = "";
47
48         final PolicyConfigStatus result = PolicyConfigStatus.getStatus(configStatus);
49
50         // add additional test code here
51         assertNotNull(result);
52         assertEquals("not_found", result.toString());
53         assertEquals("CONFIG_NOT_FOUND", result.name());
54         assertEquals(1, result.ordinal());
55
56         assertEquals(PolicyConfigStatus.CONFIG_RETRIEVED, PolicyConfigStatus.create("retrieved"));
57     }
58
59     /**
60      * Run the PolicyConfigStatus getStatus(String) method test.
61      *
62      * @throws Exception
63      *
64      * @generatedBy CodePro at 6/1/16 1:41 PM
65      */
66     @Test
67     public void testGetStatus_2() throws Exception {
68         final String configStatus = "retrieved";
69
70         final 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     @Test
80     public void testCreate_EnumName_PolicyConfigStatusEnum() {
81         for (final PolicyConfigStatus policyConfigStatus : PolicyConfigStatus.values()) {
82             final PolicyConfigStatus actualPolicyConfigStatus = PolicyConfigStatus.create(policyConfigStatus.name());
83             assertEquals(policyConfigStatus, actualPolicyConfigStatus);
84             assertEquals(policyConfigStatus.toString(), actualPolicyConfigStatus.toString());
85         }
86     }
87
88     @Test
89     public void testCreate_StringValue_PolicyClassEnum() {
90         for (final PolicyConfigStatus policyConfigStatus : PolicyConfigStatus.values()) {
91             final PolicyConfigStatus actualPolicyClass = PolicyConfigStatus.create(policyConfigStatus.toString());
92             assertEquals(policyConfigStatus, actualPolicyClass);
93         }
94     }
95
96     @Test(expected = IllegalArgumentException.class)
97     public void testException() {
98         PolicyConfigStatus.create("foobar");
99     }
100
101     /**
102      * Launch the test.
103      *
104      * @param args
105      *            the command line arguments
106      *
107      * @generatedBy CodePro at 6/1/16 1:41 PM
108      */
109     public static void main(final String[] args) {
110         new org.junit.runner.JUnitCore().run(PolicyConfigStatusTest.class);
111     }
112 }