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