From 67fcc6f6abb7904ecd4b4444fa23b355cf9fd4ae Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 24 Jun 2019 15:46:36 -0400 Subject: Fix some sonar issues in policy-endpoints Refactored various classes to reduce cyclomatic complexity. Introduced some endpoint utility classes to facilitate extraction and conversion of property values, and populating of common "builder" values. Change-Id: Ie1c91cd94cb54700dc9127f72780b4d94b82ec39 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn --- .../comm/bus/internal/SingleThreadedDmaapTopicSourceTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.java') diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.java index 29c34591..b7faf161 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSourceTest.java @@ -32,12 +32,14 @@ import org.onap.policy.common.endpoints.event.comm.bus.TopicTestBase; import org.onap.policy.common.utils.gson.GsonTestUtils; public class SingleThreadedDmaapTopicSourceTest extends TopicTestBase { + private static final String SOURCE_NAME = "SingleThreadedDmaapTopicSource ["; private SingleThreadedDmaapTopicSource source; /** * Creates the object to be tested. */ @Before + @Override public void setUp() { super.setUp(); @@ -56,17 +58,17 @@ public class SingleThreadedDmaapTopicSourceTest extends TopicTestBase { @Test public void testToString() { - assertTrue(source.toString().startsWith("SingleThreadedDmaapTopicSource [")); + assertTrue(source.toString().startsWith(SOURCE_NAME)); source.shutdown(); // try with null password source = new SingleThreadedDmaapTopicSource(makeBuilder().password(null).build()); - assertTrue(source.toString().startsWith("SingleThreadedDmaapTopicSource [")); + assertTrue(source.toString().startsWith(SOURCE_NAME)); source.shutdown(); // try with empty password source = new SingleThreadedDmaapTopicSource(makeBuilder().password("").build()); - assertTrue(source.toString().startsWith("SingleThreadedDmaapTopicSource [")); + assertTrue(source.toString().startsWith(SOURCE_NAME)); source.shutdown(); } -- cgit 1.2.3-korg