Unit/SONAR/Checkstyle in ONAP-REST
[policy/engine.git] / ONAP-REST / src / test / java / org / onap / policy / rest / jpa / ActionDictionaryJpaTest.java
index a840f9d..3967bb4 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.policy.rest.jpa;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
@@ -228,13 +229,19 @@ public class ActionDictionaryJpaTest {
 
     @Test
     public void testObadvice() {
-        Obadvice data = new Obadvice();
         new Obadvice();
         new Obadvice("Test", "Test");
+        new Obadvice(new DummyIdentifier(), "Test");
+        Obadvice data = new Obadvice();
         data.clone();
         data.addObadviceExpression(new ObadviceExpression());
+        assertNotNull(data.clone());
         data.removeObadviceExpression(new ObadviceExpression());
         data.removeAllExpressions();
+        assertEquals(0, data.getObadviceExpressions().size());
+        data.setObadviceExpressions(null);
+        assertNull(data.getObadviceExpressions());
+        data.removeAllExpressions();
         data.prePersist();
         data.preUpdate();
         data.setId(1);
@@ -253,6 +260,7 @@ public class ActionDictionaryJpaTest {
         assertTrue("Test".equals(data.getType()));
         data.setXacmlId("Test");
         assertTrue("Test".equals(data.getXacmlId()));
+
     }
 
     @Test
@@ -349,5 +357,13 @@ public class ActionDictionaryJpaTest {
         assertTrue("Test".equals(data.getXacmlId()));
         data.setIsStandard(PolicyAlgorithms.STANDARD);
         assertTrue(data.isStandard());
+        assertFalse(data.isCustom());
+        data.setIsStandard(PolicyAlgorithms.CUSTOM);
+        assertFalse(data.isStandard());
+        assertTrue(data.isCustom());
+
+        DummyIdentifier identifier = new DummyIdentifier();
+        assertNotNull(new PolicyAlgorithms(identifier));
+        assertNotNull(new PolicyAlgorithms(identifier, 'C'));
     }
 }