aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Hwang <mhwang@research.att.com>2018-09-19 14:21:12 -0400
committerMichael Hwang <mhwang@research.att.com>2018-09-19 14:21:39 -0400
commite09d200eaf5a3b36652433f3b8581192d7e0b52b (patch)
treef2352bf1ca36e3fb5f58a004f4bef297dd9e1dca
parentf8426d18257c33fa8a0267e4f96f7e53bb4a82ee (diff)
Re-increase code coverage to 50%3.0.43.0.1-ONAP3.0.0-ONAPcasablanca
Change-Id: Ia707c6ef1837b26ccd895ccf075626a2e8f6da34 Issue-ID: DCAEGEN2-803 Signed-off-by: Michael Hwang <mhwang@research.att.com>
-rw-r--r--src/test/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapperTests.java4
-rw-r--r--src/test/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceComponentObjectTests.java13
2 files changed, 17 insertions, 0 deletions
diff --git a/src/test/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapperTests.java b/src/test/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapperTests.java
index bdac01d..d2d1670 100644
--- a/src/test/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapperTests.java
+++ b/src/test/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapperTests.java
@@ -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");
}
diff --git a/src/test/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceComponentObjectTests.java b/src/test/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceComponentObjectTests.java
index 1d80059..b4fe644 100644
--- a/src/test/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceComponentObjectTests.java
+++ b/src/test/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceComponentObjectTests.java
@@ -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"));
+ }
+
}