X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Ftest%2FPolicyTypeTest.java;h=49bdfe876682528669fd31768f5780819d6a4387;hb=5450bdbfb94fb5217617da6c41971fd26f7e81b5;hp=267dd9771a1ee2c9de953840b2dded93d2c94634;hpb=a9710cb3b80c73c98d257c676ba6ecf9e30ef758;p=policy%2Fengine.git diff --git a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java index 267dd9771..49bdfe876 100644 --- a/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java +++ b/PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java @@ -20,79 +20,69 @@ package org.onap.policy.test; -import org.junit.*; -import org.onap.policy.api.PolicyType; +import static org.junit.Assert.assertEquals; -import static org.junit.Assert.*; +import org.junit.Test; +import org.onap.policy.api.PolicyType; /** - * The class PolicyTypeTest contains tests for the class {@link PolicyType}. + * The class PolicyTypeTest contains tests for the class + * {@link PolicyType}. * * @generatedBy CodePro at 6/1/16 1:41 PM * @version $Revision: 1.0 $ */ public class PolicyTypeTest { - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Test - public void testToString_1() - throws Exception { - PolicyType fixture = PolicyType.JSON; + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + @Test + public void testToString_1() throws Exception { + final PolicyType fixture = PolicyType.JSON; + + final String result = fixture.toString(); + + // add additional test code here + assertEquals("json", result); - String result = fixture.toString(); + assertEquals(PolicyType.JSON, PolicyType.create("json")); + } - // add additional test code here - assertEquals("json", result); - - assertEquals(PolicyType.JSON, PolicyType.create("json")); - } - - @Test(expected = IllegalArgumentException.class) - public void testException() { - PolicyType.create("foobar"); - } + @Test + public void testCreate_EnumName_PolicyTypeEnum() { + for (final PolicyType policyType : PolicyType.values()) { + final PolicyType actualPolicyType = PolicyType.create(policyType.name()); + assertEquals(policyType, actualPolicyType); + assertEquals(policyType.toString(), actualPolicyType.toString()); + } + } - /** - * Perform pre-test initialization. - * - * @throws Exception - * if the initialization fails for some reason - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @Before - public void setUp() - throws Exception { - // add additional set up code here - } + @Test + public void testCreate_StringValue_PolicyTypeEnum() { + for (final PolicyType policyType : PolicyType.values()) { + final PolicyType actualPolicyType = PolicyType.create(policyType.toString()); + assertEquals(policyType, actualPolicyType); + } + } - /** - * Perform post-test clean-up. - * - * @throws Exception - * if the clean-up fails for some reason - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - @After - public void tearDown() - throws Exception { - // Add additional tear down code here - } + @Test(expected = IllegalArgumentException.class) + public void testException() { + PolicyType.create("foobar"); + } - /** - * Launch the test. - * - * @param args the command line arguments - * - * @generatedBy CodePro at 6/1/16 1:41 PM - */ - public static void main(String[] args) { - new org.junit.runner.JUnitCore().run(PolicyTypeTest.class); - } + /** + * Launch the test. + * + * @param args + * the command line arguments + * + * @generatedBy CodePro at 6/1/16 1:41 PM + */ + public static void main(final String[] args) { + new org.junit.runner.JUnitCore().run(PolicyTypeTest.class); + } }