diff options
author | xuegao <xue.gao@intl.att.com> | 2021-03-01 09:19:39 +0100 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2021-03-10 13:22:39 +0000 |
commit | 114b2affd49c0c5a77f65267d53fc417d79d29f7 (patch) | |
tree | 44b2b3c46d5d12c94e54496c04c5ff524c0d4b4a /common | |
parent | 280149632b48dfabd4c12719d1ff391414bbd02f (diff) |
Fix sonar bugs
Fix the bugs indicated by Sonar in YamlUtilTest.
Issue-ID: SDC-3428
Change-Id: Ic0a4b9e4ee45d047414bb14929abcd5d390466d4
Signed-off-by: xuegao <xue.gao@intl.att.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/services/YamlUtilTest.java | 12 | ||||
-rw-r--r-- | common/onap-tosca-datatype/src/test/resources/yamlMap.yaml | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/services/YamlUtilTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/services/YamlUtilTest.java index 562b208bde..063680f9ed 100644 --- a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/services/YamlUtilTest.java +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/services/YamlUtilTest.java @@ -42,18 +42,18 @@ public class YamlUtilTest { InputStream is = yamlUtil.loadYamlFileIs("/yamlMap.yaml"); Map<String, LinkedHashMap<String, Object>> res = yamlUtil.yamlToMap(is); assertNotNull(res); - assertEquals(res.size(), 3); - assertEquals(res.get("parameter1"), "value1"); - assertEquals(res.get("parameter2"), "value2"); - assertEquals(res.get("parameter3"), "value3"); + assertEquals(1, res.size()); + assertEquals("value1", (String)res.get("complex-mapping").get("parameter1")); + assertEquals("value2", (String)res.get("complex-mapping").get("parameter2")); + assertEquals("value3", (String)res.get("complex-mapping").get("parameter3")); } @Test public void testYamlToList() { InputStream is = yamlUtil.loadYamlFileIs("/yamlList.yaml"); Optional<List<Object>> res = yamlUtil.yamlToList(is); - assertEquals(res.get().size(), 3); - assertEquals(res.get().get(0), "value1"); + assertEquals(3, res.get().size()); + assertEquals("value1", res.get().get(0)); InputStream is2 = yamlUtil.loadYamlFileIs("/yamlListError.yaml"); Optional<List<Object>> res2 = yamlUtil.yamlToList(is2); diff --git a/common/onap-tosca-datatype/src/test/resources/yamlMap.yaml b/common/onap-tosca-datatype/src/test/resources/yamlMap.yaml index d4a07a82a5..4fa455c452 100644 --- a/common/onap-tosca-datatype/src/test/resources/yamlMap.yaml +++ b/common/onap-tosca-datatype/src/test/resources/yamlMap.yaml @@ -1,3 +1,4 @@ -parameter1: value1 -parameter2: value2 -parameter3: value3
\ No newline at end of file +complex-mapping: + parameter1: value1 + parameter2: value2 + parameter3: value3
\ No newline at end of file |