diff options
Diffstat (limited to 'PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java')
-rw-r--r-- | PolicyEngineAPI/src/test/java/org/onap/policy/test/PolicyTypeTest.java | 114 |
1 files changed, 52 insertions, 62 deletions
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 <code>PolicyTypeTest</code> contains tests for the class <code>{@link PolicyType}</code>. + * The class <code>PolicyTypeTest</code> contains tests for the class + * <code>{@link PolicyType}</code>. * * @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); + } } |