aboutsummaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-09-28 14:37:44 -0400
committerJim Hahn <jrh3@att.com>2020-09-28 16:55:12 -0400
commit1e39e2bf48a7122aec00792cf43672a46ae9fa65 (patch)
tree95b9bd3000eef08a7ef49184a562bd077a035f24 /policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java
parentfa868f63c30bf33fc90b5173dba0df5ccdc90219 (diff)
New sonars in policy-common
Addressed the following sonars: - too many assertions in a test case - use parameterized test method Disabled production sonars for util-test, as the entire module is only used for testing other modules. Issue-ID: POLICY-2650-sonar Change-Id: If49775a6c95855dcd9601ee0d833bb00741b1550 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java')
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java
index 67b84ea8..0f09b12e 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBaseTest.java
@@ -194,9 +194,15 @@ public class TopicBaseTest extends TopicTestBase {
assertTrue(base.unlock());
assertEquals(1, base.startCount);
assertEquals(1, base.stopCount);
+ }
+
+ /**
+ * Tests lock/unlock when the stop/start methods return false.
+ */
+ @Test
+ public void testLock_testUnlock_FalseReturns() {
// lock, but stop returns false
- base = new TopicBaseImpl(servers, MY_TOPIC);
base.stopReturn = false;
assertFalse(base.lock());
assertTrue(base.isLocked());
@@ -207,9 +213,15 @@ public class TopicBaseTest extends TopicTestBase {
assertFalse(base.unlock());
assertFalse(base.isLocked());
assertTrue(base.unlock());
+ }
+
+ /**
+ * Tests lock/unlock when the start method throws an exception.
+ */
+ @Test
+ public void testLock_testUnlock_Exception() {
// lock & re-lock, but start throws an exception
- base = new TopicBaseImpl(servers, MY_TOPIC);
base.startEx = true;
assertTrue(base.lock());
assertFalse(base.unlock());