From dbfa1570cd26d19b346287a6fb06f2d8a03f4a06 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Mon, 7 Oct 2019 15:26:08 -0400 Subject: Use lombok for data objects Removing lines to see if this will bump coverage. Some sonar for Junit tests and missing coverage. My next task will be to re-use some of this duplicate code for these object types and the controllers. Trailing spaces for patch #3. Issue-ID: POLICY-2133 Change-Id: Iaee123c6be4b63bd831172340709fe7597feaa78 Signed-off-by: Pamela Dragosh --- .../onap/policy/controller/PDPControllerTest.java | 25 +++++++++++++++++++--- .../controller/PolicyRolesControllerTest.java | 5 +++++ 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'POLICY-SDK-APP/src/test') diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java index 0d5a09754..372090fdf 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java @@ -22,6 +22,7 @@ package org.onap.policy.controller; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.UnsupportedEncodingException; @@ -50,6 +51,11 @@ public class PDPControllerTest extends Mockito { private Set groups; private static List rolesdata; + /** + * Before. + * + * @throws Exception Exception + */ @Before public void setUp() throws Exception { logger.info("setUp: Entering"); @@ -79,9 +85,9 @@ public class PDPControllerTest extends Mockito { } @Test - public void testPDPGroupData() { - HttpServletRequest request = mock(HttpServletRequest.class); - MockHttpServletResponse response = new MockHttpServletResponse(); + public void testPdpGroupData() { + final HttpServletRequest request = mock(HttpServletRequest.class); + final MockHttpServletResponse response = new MockHttpServletResponse(); PolicyController controller = mock(PolicyController.class); PDPController pdpController = new PDPController(); pdpController.setJunit(true);; @@ -95,4 +101,17 @@ public class PDPControllerTest extends Mockito { logger.error("Exception Occured" + e); } } + + @Test + public void testPdpData() { + PdpData data = new PdpData(); + data.setId("id"); + assertEquals("id", data.getId()); + data.setDescription("foo"); + assertEquals("foo", data.getDescription()); + data.setJmxPort(0); + assertEquals(0, data.getJmxPort()); + data.setName("name"); + assertEquals("name", data.getName()); + } } diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java index 720f6ca76..e24525619 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java @@ -51,6 +51,11 @@ public class PolicyRolesControllerTest { private PolicyRolesController controller = null; private static CommonClassDao commonClassDao; + /** + * Before. + * + * @throws Exception exception + */ @Before public void setUp() throws Exception { logger.info("setUp: Entering"); -- cgit 1.2.3-korg