Re-increase code coverage to 50% 37/67837/1 casablanca 3.0.0-ONAP 3.0.1-ONAP 3.0.4
authorMichael Hwang <mhwang@research.att.com>
Wed, 19 Sep 2018 18:21:12 +0000 (14:21 -0400)
committerMichael Hwang <mhwang@research.att.com>
Wed, 19 Sep 2018 18:21:39 +0000 (14:21 -0400)
Change-Id: Ia707c6ef1837b26ccd895ccf075626a2e8f6da34
Issue-ID: DCAEGEN2-803
Signed-off-by: Michael Hwang <mhwang@research.att.com>
src/test/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapperTests.java
src/test/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceComponentObjectTests.java

index bdac01d..d2d1670 100644 (file)
@@ -102,6 +102,10 @@ public class DCAEServiceTypeObjectMapperTests {
                 }
             });
             TestCase.assertNotNull(mapper.map(0, resultSet, null));
+
+            when(resultSet.getArray("service_ids")).thenReturn(null);
+            when(resultSet.getArray("service_locations")).thenReturn(null);
+            TestCase.assertNotNull(mapper.map(0, resultSet, null));
         } catch (Exception e) {
             fail("Unexpected exception");
         }
index 1d80059..b4fe644 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.dcae.inventory.dbthings.models;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
 
@@ -69,4 +70,16 @@ public class DCAEServiceComponentObjectTests {
         assertNotSame(objectUpdated.getModified(), objectFirst.getModified());
     }
 
+    @Test
+    public void testToString() {
+        DCAEServiceComponentRequest request = (new DCAEServiceComponentRequest()).componentId("some-component-id")
+                .componentType("scary-component-type");
+        request.setComponentSource("controller");
+        request.setShareable(0);
+
+        DCAEServiceComponentObject object = new DCAEServiceComponentObject(request);
+        String stringObject = object.toString();
+        assertTrue(stringObject.contains("componentId"));
+    }
+
 }