X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Ftest%2FPolicyClassTest.java;h=88b3bc8cb6482e026c7433dd1c34a04e90536c4b;hb=5450bdbfb94fb5217617da6c41971fd26f7e81b5;hp=b4aaa64d8e9f5bc69ef73994ad596811eca68580;hpb=a9710cb3b80c73c98d257c676ba6ecf9e30ef758;p=policy%2Fengine.git
diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java
index b4aaa64d8..88b3bc8cb 100644
--- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java
+++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyClassTest.java
@@ -20,78 +20,63 @@
package org.onap.policy.test;
-import org.junit.*;
-import org.onap.policy.api.PolicyClass;
+import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.policy.api.PolicyClass;
/**
- * The class PolicyClassTest
contains tests for the class {@link PolicyClass}
.
+ * The class PolicyClassTest
contains tests for the class
+ * {@link PolicyClass}
.
*
* @generatedBy CodePro at 6/1/16 1:40 PM
* @version $Revision: 1.0 $
*/
public class PolicyClassTest {
- /**
- * Run the String toString() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Test
- public void testToString_1() {
- PolicyClass fixture = PolicyClass.Action;
- String result = fixture.toString();
+ @Test
+ public void testToString_1() {
+ final PolicyClass fixture = PolicyClass.Action;
+
+ final String result = fixture.toString();
+
+ // add additional test code here
+ assertEquals("Action", result);
+
+ assertEquals(PolicyClass.Decision, PolicyClass.create(PolicyClass.Decision.toString()));
+ }
- // add additional test code here
- assertEquals("Action", result);
-
- assertEquals(PolicyClass.Decision, PolicyClass.create(PolicyClass.Decision.toString()));
- }
+ @Test
+ public void testCreate_EnumName_PolicyClassEnum() {
+ for (final PolicyClass policyClass : PolicyClass.values()) {
+ final PolicyClass actualPolicyClass = PolicyClass.create(policyClass.name());
+ assertEquals(policyClass, actualPolicyClass);
+ assertEquals(policyClass.toString(), actualPolicyClass.toString());
+ }
+ }
- @Test(expected = IllegalArgumentException.class)
- public void testException() {
- PolicyClass.create("foobar");
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
+ @Test
+ public void testCreate_StringValue_PolicyClassEnum() {
+ for (final PolicyClass policyClass : PolicyClass.values()) {
+ final PolicyClass actualPolicyClass = PolicyClass.create(policyClass.toString());
+ assertEquals(policyClass, actualPolicyClass);
+ }
+ }
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testException() {
+ PolicyClass.create("foobar");
+ }
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 6/1/16 1:40 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(PolicyClassTest.class);
- }
+ /**
+ * Launch the test.
+ *
+ * @param args
+ * the command line arguments
+ *
+ * @generatedBy CodePro at 6/1/16 1:40 PM
+ */
+ public static void main(final String[] args) {
+ new org.junit.runner.JUnitCore().run(PolicyClassTest.class);
+ }
}