1 package org.openecomp.sdc.be.servlets;
3 import static org.junit.Assert.assertFalse;
4 import static org.junit.Assert.assertNotNull;
5 import static org.junit.Assert.assertTrue;
7 import java.util.HashMap;
8 import org.apache.tinkerpop.gremlin.structure.T;
10 import org.openecomp.sdc.be.model.ArtifactDefinition;
11 import org.openecomp.sdc.be.model.Operation;
13 public class RepresentationUtilsTest {
15 private RepresentationUtils createTestSubject() {
16 return new RepresentationUtils();
21 public void testConvertJsonToArtifactDefinitionForUpdate() throws Exception {
23 Class<ArtifactDefinition> clazz = null;
24 ArtifactDefinition result;
27 result = RepresentationUtils.convertJsonToArtifactDefinitionForUpdate(content, clazz);
32 public void testToRepresentation() throws Exception {
33 T elementToRepresent = null;
37 result = RepresentationUtils.toRepresentation(elementToRepresent);
44 public void testConvertJsonToArtifactDefinition() throws Exception {
46 Class<ArtifactDefinition> clazz = null;
47 ArtifactDefinition result;
50 result = RepresentationUtils.convertJsonToArtifactDefinition(content, clazz);
54 public void checkIsEmptyFiltering() throws Exception {
55 HashMap<String, Operation> op = new HashMap<>();
56 Operation opValue = new Operation();
57 opValue.setName("eee");
58 opValue.setDescription("ccc");
59 op.put("Bla", opValue);
60 Object result = RepresentationUtils.toRepresentation(op);
61 assertNotNull(result);
62 assertTrue(result.toString(), result.toString().contains("empty"));
63 result = RepresentationUtils.toFilteredRepresentation(op);
64 assertNotNull(result);
65 assertFalse(result.toString(), result.toString().contains("empty"));