summaryrefslogtreecommitdiffstats
path: root/utils/src/test
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 /utils/src/test
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 'utils/src/test')
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java25
1 files changed, 8 insertions, 17 deletions
diff --git a/utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java b/utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java
index 07e0795f..5fb92f8e 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - Common Modules
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-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.
@@ -80,6 +80,10 @@ public class BeanConfiguratorTest {
@Test
public void testConfigureFromProperties() throws PropertyException {
+ testStringValueNoDefault();
+ }
+
+ private void testStringValueNoDefault() throws PropertyException {
props.setProperty(THE_VALUE, STRING_VALUE);
PlainStringConfig cfg = new PlainStringConfig();
@@ -177,11 +181,7 @@ public class BeanConfiguratorTest {
@Test
public void testSetValueObjectFieldProperties_FieldSet() throws PropertyException {
- props.setProperty(THE_VALUE, STRING_VALUE);
- PlainStringConfig cfg = new PlainStringConfig();
- beancfg.configureFromProperties(cfg, props);
-
- assertEquals(STRING_VALUE, cfg.value);
+ testStringValueNoDefault();
}
@Test
@@ -500,11 +500,7 @@ public class BeanConfiguratorTest {
@Test
public void testGetStringValue() throws PropertyException {
- props.setProperty(THE_VALUE, STRING_VALUE);
- PlainStringConfig cfg = new PlainStringConfig();
- beancfg.configureFromProperties(cfg, props);
-
- assertEquals(STRING_VALUE, cfg.value);
+ testStringValueNoDefault();
}
@Test
@@ -721,12 +717,7 @@ public class BeanConfiguratorTest {
@Test
public void testGetPropValue_Prop_NoDefault() throws PropertyException {
- props.setProperty(THE_VALUE, STRING_VALUE);
-
- PlainStringConfig cfg = new PlainStringConfig();
- beancfg.configureFromProperties(cfg, props);
-
- assertEquals(STRING_VALUE, cfg.value);
+ testStringValueNoDefault();
}
@Test