summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionDeserializerTest.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionDeserializerTest.java b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionDeserializerTest.java
new file mode 100644
index 0000000..c98b408
--- /dev/null
+++ b/src/test/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ActionDeserializerTest.java
@@ -0,0 +1,29 @@
+package org.onap.sdc.dcae.composition.restmodels.ruleeditor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.sdc.dcae.composition.restmodels.ruleeditor.ActionDeserializer;
+import org.onap.sdc.dcae.composition.restmodels.ruleeditor.BaseAction;
+import org.onap.sdc.dcae.composition.restmodels.ruleeditor.MapAction;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+public class ActionDeserializerTest {
+
+
+ private Gson gson = new GsonBuilder().registerTypeAdapter(BaseAction.class, new ActionDeserializer()).create();
+
+ @Test
+ public void deserializerTest(){
+ BaseAction action = new BaseAction();
+ action.setActionType("map");
+ String input = gson.toJson(action);
+ BaseAction res = gson.fromJson(input, BaseAction.class);
+ assertEquals(gson.toJson(res), input);
+ assertTrue(res instanceof MapAction);
+ }
+
+} \ No newline at end of file