Reduce technical debt and add JUnit
[policy/engine.git] / PolicyEngineAPI / src / test / java / org / onap / policy / test / PolicyDecisionTest.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.PolicyDecision;
25
26 import static org.junit.Assert.*;
27
28 /**
29  * The class <code>PolicyDecisionTest</code> contains tests for the class <code>{@link PolicyDecision}</code>.
30  *
31  * @generatedBy CodePro at 6/1/16 1:41 PM
32  * @version $Revision: 1.0 $
33  */
34 public class PolicyDecisionTest {
35         /**
36          * Run the String toString() method test.
37          *
38          * @throws Exception
39          *
40          * @generatedBy CodePro at 6/1/16 1:41 PM
41          */
42         @Test
43         public void testToString_1()
44                 throws Exception {
45                 PolicyDecision fixture = PolicyDecision.DENY;
46
47                 String result = fixture.toString();
48
49                 // add additional test code here
50                 assertEquals("deny", result);
51                 
52                 assertEquals(PolicyDecision.PERMIT, PolicyDecision.create(PolicyDecision.PERMIT.name()));
53         }
54         
55         @Test(expected = IllegalArgumentException.class)
56         public void testException() {
57                 PolicyDecision.create("foobar");
58         }
59
60         /**
61          * Perform pre-test initialization.
62          *
63          * @throws Exception
64          *         if the initialization fails for some reason
65          *
66          * @generatedBy CodePro at 6/1/16 1:41 PM
67          */
68         @Before
69         public void setUp()
70                 throws Exception {
71                 // add additional set up code here
72         }
73
74         /**
75          * Perform post-test clean-up.
76          *
77          * @throws Exception
78          *         if the clean-up fails for some reason
79          *
80          * @generatedBy CodePro at 6/1/16 1:41 PM
81          */
82         @After
83         public void tearDown()
84                 throws Exception {
85                 // Add additional tear down code here
86         }
87
88         /**
89          * Launch the test.
90          *
91          * @param args the command line arguments
92          *
93          * @generatedBy CodePro at 6/1/16 1:41 PM
94          */
95         public static void main(String[] args) {
96                 new org.junit.runner.JUnitCore().run(PolicyDecisionTest.class);
97         }
98 }