summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org
diff options
context:
space:
mode:
authorshrek2000 <orenkle@amdocs.com>2018-03-21 13:26:35 +0200
committerEinav Keidar <einavw@amdocs.com>2018-03-22 12:25:46 +0000
commitc86ab44bb10562aa4c3e553eecaa2325d050fb2e (patch)
tree3ee1cb3dcf02f9a2130062a6d78a93539f12ccbb /catalog-be/src/test/java/org
parent328388b792b5b39d37c98d82a853ae4fa17c9313 (diff)
Json Serialization should hide "empty".
Json serialization of java collections exposes the isEmpty function as an attribute. This issue was discussed in the design review of Interface operations. Issue-ID: SDC-1150 Change-Id: I09e214f5631b73d60825732c4db8bbf85469c824 Signed-off-by: shrek2000 <orenkle@amdocs.com>
Diffstat (limited to 'catalog-be/src/test/java/org')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java99
1 files changed, 60 insertions, 39 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java
index f82fdfc1ef..63e76700df 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java
@@ -1,46 +1,67 @@
package org.openecomp.sdc.be.servlets;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
import org.apache.tinkerpop.gremlin.structure.T;
import org.junit.Test;
import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Operation;
+
+public class RepresentationUtilsTest {
+
+ private RepresentationUtils createTestSubject() {
+ return new RepresentationUtils();
+ }
+
+
+ @Test
+ public void testConvertJsonToArtifactDefinitionForUpdate() throws Exception {
+ String content = "";
+ Class<ArtifactDefinition> clazz = null;
+ ArtifactDefinition result;
+
+ // default test
+ result = RepresentationUtils.convertJsonToArtifactDefinitionForUpdate(content, clazz);
+ }
+
+
+ @Test
+ public void testToRepresentation() throws Exception {
+ T elementToRepresent = null;
+ Object result;
+
+ // default test
+ result = RepresentationUtils.toRepresentation(elementToRepresent);
+ }
+
+
+
+
+ @Test
+ public void testConvertJsonToArtifactDefinition() throws Exception {
+ String content = "";
+ Class<ArtifactDefinition> clazz = null;
+ ArtifactDefinition result;
+
+ // default test
+ result = RepresentationUtils.convertJsonToArtifactDefinition(content, clazz);
+ }
-public class RepresentationUtilsTest {
-
- private RepresentationUtils createTestSubject() {
- return new RepresentationUtils();
- }
-
-
- @Test
- public void testConvertJsonToArtifactDefinitionForUpdate() throws Exception {
- String content = "";
- Class<ArtifactDefinition> clazz = null;
- ArtifactDefinition result;
-
- // default test
- result = RepresentationUtils.convertJsonToArtifactDefinitionForUpdate(content, clazz);
- }
-
-
- @Test
- public void testToRepresentation() throws Exception {
- T elementToRepresent = null;
- Object result;
-
- // default test
- result = RepresentationUtils.toRepresentation(elementToRepresent);
- }
-
-
-
-
- @Test
- public void testConvertJsonToArtifactDefinition() throws Exception {
- String content = "";
- Class<ArtifactDefinition> clazz = null;
- ArtifactDefinition result;
-
- // default test
- result = RepresentationUtils.convertJsonToArtifactDefinition(content, clazz);
- }
+ @Test
+ public void checkIsEmptyFiltering() throws Exception {
+ HashMap<String, Operation> op = new HashMap<>();
+ Operation opValue = new Operation();
+ opValue.setName("eee");
+ opValue.setDescription("ccc");
+ op.put("Bla", opValue);
+ Object result = RepresentationUtils.toRepresentation(op);
+ assertNotNull(result);
+ assertTrue(result.toString(), result.toString().contains("empty"));
+ result = RepresentationUtils.toFilteredRepresentation(op);
+ assertNotNull(result);
+ assertFalse(result.toString(), result.toString().contains("empty"));
+ }
} \ No newline at end of file