diff options
author | Jim Hahn <jrh3@att.com> | 2020-09-28 14:37:44 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-09-28 16:55:12 -0400 |
commit | 1e39e2bf48a7122aec00792cf43672a46ae9fa65 (patch) | |
tree | 95b9bd3000eef08a7ef49184a562bd077a035f24 /policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java | |
parent | fa868f63c30bf33fc90b5173dba0df5ccdc90219 (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/BusTopicParamsTest.java')
-rw-r--r-- | policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java index c00f2b56..93e5067e 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * policy-endpoints * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ public class BusTopicParamsTest extends TopicTestBase { } @Test - public void test() { + public void testGetters() { BusTopicParams params = makeBuilder().build(); assertEquals(addProps, params.getAdditionalProps()); @@ -69,11 +69,19 @@ public class BusTopicParamsTest extends TopicTestBase { assertEquals(MY_EFFECTIVE_TOPIC, params.getEffectiveTopic()); assertEquals(true, params.isUseHttps()); assertEquals(MY_USERNAME, params.getUserName()); + } + @Test + public void testBooleanGetters() { // ensure that booleans are independent of each other testBoolean("true:false:false", (bldr, flag) -> bldr.allowSelfSignedCerts(flag)); testBoolean("false:true:false", (bldr, flag) -> bldr.managed(flag)); testBoolean("false:false:true", (bldr, flag) -> bldr.useHttps(flag)); + } + + @Test + public void testValidators() { + BusTopicParams params = makeBuilder().build(); // test validity methods assertTrue(params.isAdditionalPropsValid()); @@ -94,8 +102,10 @@ public class BusTopicParamsTest extends TopicTestBase { assertFalse(params.isServersInvalid()); assertFalse(params.isTopicInvalid()); assertTrue(params.isUserNameValid()); + } - // test inverted validity + @Test + public void testInvertedValidators() { assertFalse(makeBuilder().additionalProps(null).build().isAdditionalPropsValid()); assertTrue(makeBuilder().aftEnvironment("").build().isAftEnvironmentInvalid()); assertFalse(makeBuilder().apiKey("").build().isApiKeyValid()); |