From e09d200eaf5a3b36652433f3b8581192d7e0b52b Mon Sep 17 00:00:00 2001 From: Michael Hwang Date: Wed, 19 Sep 2018 14:21:12 -0400 Subject: Re-increase code coverage to 50% Change-Id: Ia707c6ef1837b26ccd895ccf075626a2e8f6da34 Issue-ID: DCAEGEN2-803 Signed-off-by: Michael Hwang --- .../dbthings/mappers/DCAEServiceTypeObjectMapperTests.java | 4 ++++ .../dbthings/models/DCAEServiceComponentObjectTests.java | 13 +++++++++++++ 2 files changed, 17 insertions(+) (limited to 'src') 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")); + } + } -- cgit 1.2.3-korg