summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionDeserializerTest.java28
-rw-r--r--src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/DateFormatterActionTest.java28
-rw-r--r--src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapActionTest.java27
-rw-r--r--src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRulesTest.java35
-rw-r--r--src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/RuleTest.java39
5 files changed, 155 insertions, 2 deletions
diff --git a/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionDeserializerTest.java b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionDeserializerTest.java
new file mode 100644
index 0000000..42c2ecb
--- /dev/null
+++ b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ConditionDeserializerTest.java
@@ -0,0 +1,28 @@
+package org.onap.sdc.dcae.composition.restmodels.ruleeditor;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import org.junit.Test;
+
+import java.util.ArrayList;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class ConditionDeserializerTest {
+
+ private Gson gson = new GsonBuilder().registerTypeAdapter(BaseCondition.class, new ConditionDeserializer()).create();
+
+ @Test
+ public void deserializerTest(){
+ Condition condition = new Condition();
+ condition.setLeft("map");
+ condition.setRight(new ArrayList<>());
+ condition.setOperator("test");
+ condition.setEmptyIsAssigned(true);
+ String input = gson.toJson(condition);
+ BaseCondition res = gson.fromJson(input, BaseCondition.class);
+ assertEquals(gson.toJson(res), input);
+ assertTrue(res instanceof Condition);
+ }
+}
diff --git a/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/DateFormatterActionTest.java b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/DateFormatterActionTest.java
new file mode 100644
index 0000000..defec7f
--- /dev/null
+++ b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/DateFormatterActionTest.java
@@ -0,0 +1,28 @@
+package org.onap.sdc.dcae.composition.restmodels.ruleeditor;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class DateFormatterActionTest {
+ private DateFormatterAction classUnderTest = new DateFormatterAction();
+
+ @Test
+ public void checkEqualsTrueOther() {
+ DateFormatterAction dateFormatterAction = new DateFormatterAction();
+ assertTrue(classUnderTest.equals(dateFormatterAction));
+ }
+
+ @Test
+ public void checkEqualsTrueSame() {
+ assertTrue(classUnderTest.equals(classUnderTest));
+ }
+
+ @Test
+ public void checkEqualsFalse() {
+ assertFalse(classUnderTest.equals(null));
+ }
+
+
+}
diff --git a/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapActionTest.java b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapActionTest.java
new file mode 100644
index 0000000..7a3c9a1
--- /dev/null
+++ b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MapActionTest.java
@@ -0,0 +1,27 @@
+package org.onap.sdc.dcae.composition.restmodels.ruleeditor;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class MapActionTest {
+ private MapAction classUnderTest = new MapAction();
+
+ @Test
+ public void checkEqualsTrueOther() {
+ MapAction equalMapAction = new MapAction();
+ assertTrue(classUnderTest.equals(equalMapAction));
+ }
+
+ @Test
+ public void checkEqualsTrueSame() {
+ assertTrue(classUnderTest.equals(classUnderTest));
+ }
+
+ @Test
+ public void checkEqualsFalse() {
+ assertFalse(classUnderTest.equals(null));
+ }
+
+}
diff --git a/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRulesTest.java b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRulesTest.java
index 705ef6a..ae87b57 100644
--- a/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRulesTest.java
+++ b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/MappingRulesTest.java
@@ -5,8 +5,7 @@ import org.junit.Test;
import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCodeFor;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.junit.Assert.*;
public class MappingRulesTest {
@@ -38,6 +37,38 @@ public class MappingRulesTest {
}
@Test
+ public void getRulesTest() {
+ classUnderTest.addOrReplaceRule(new Rule());
+ assertEquals(1, classUnderTest.getRules().size());
+ }
+
+ @Test
+ public void containsRulesTest() {
+ Rule rule = new Rule();
+ assertFalse(classUnderTest.ruleExists(rule));
+ assertTrue(classUnderTest.isEmpty());
+ classUnderTest.addOrReplaceRule(rule);
+ assertTrue(classUnderTest.ruleExists(rule));
+ assertFalse(classUnderTest.isEmpty());
+ }
+
+ @Test
+ public void checkEqualsTrueOther() {
+ MappingRules equalMappingRules = new MappingRules();
+ assertTrue(classUnderTest.equals(equalMappingRules));
+ }
+
+ @Test
+ public void checkEqualsTrueSame() {
+ assertTrue(classUnderTest.equals(classUnderTest));
+ }
+
+ @Test
+ public void checkEqualsFalse() {
+ assertFalse(classUnderTest.equals(null));
+ }
+
+ @Test
public void testHasValidConstructor() {
assertThat(MappingRules.class, hasValidBeanConstructor());
}
diff --git a/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/RuleTest.java b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/RuleTest.java
new file mode 100644
index 0000000..27f8185
--- /dev/null
+++ b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/RuleTest.java
@@ -0,0 +1,39 @@
+package org.onap.sdc.dcae.composition.restmodels.ruleeditor;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCodeFor;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public class RuleTest {
+ private Rule classUnderTest = new Rule();
+
+ @Test
+ public void checkEqualsTrueOther() {
+ Rule equalRule = new Rule();
+ assertTrue(classUnderTest.equals(equalRule));
+ }
+
+ @Test
+ public void checkEqualsTrueSame() {
+ assertTrue(classUnderTest.equals(classUnderTest));
+ }
+
+ @Test
+ public void checkEqualsFalse() {
+ assertFalse(classUnderTest.equals(null));
+ }
+
+ @Test
+ public void testHasValidConstructor() {
+ assertThat(Rule.class, hasValidBeanConstructor());
+ }
+
+ @Test
+ public void checkHashCodeFor() {
+ assertThat(Rule.class, hasValidBeanHashCodeFor());
+ }
+}