From c3391bef9e04c2ad38ed96bd28a5c43ab6d961de Mon Sep 17 00:00:00 2001 From: SravanKumarGunda Date: Thu, 18 Jun 2020 19:05:44 +0530 Subject: Code Improvements-Sonar Issue Fixes Signed-off-by: SravanKumarGunda Issue-ID: CLI-270 Change-Id: Iba00ddc8c471bc5990d87ba3729af373e2bd6711 --- .../onap/cli/fw/http/utils/OnapCommandUtilsTest.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'profiles/http/src/test/java') diff --git a/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java b/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java index 37fc8461..6807321e 100644 --- a/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java +++ b/profiles/http/src/test/java/org/onap/cli/fw/http/utils/OnapCommandUtilsTest.java @@ -53,6 +53,8 @@ import java.util.List; import org.onap.cli.fw.error.OnapCommandResultMapProcessingFailed; import org.onap.cli.fw.error.OnapCommandResultEmpty; import static org.junit.Assert.assertFalse; +import org.onap.cli.fw.http.connect.HttpInput; +import org.onap.cli.fw.http.connect.HttpInput.Part; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OnapCommandUtilsTest { @@ -205,4 +207,22 @@ public class OnapCommandUtilsTest { + "[\"3a2fb75b52a54e9c8093e7c154210f9e\"]}]}}}"; assertEquals(result, OnapCommandHttpUtils.normalizeJson(sample)); } + + @Test + public void testPopulateParameters() throws OnapCommandException { + List multiparts = new ArrayList (); + Part part = new Part(); + part.setContent("content"); + multiparts.add(part); + Map params = new HashMap (); + OnapCommandParameter onapCommandParameter = new OnapCommandParameter(); + onapCommandParameter.setName("CMD"); + onapCommandParameter.setRawDefaultValue("value"); + params.put("key", onapCommandParameter); + HttpInput httpInput = new HttpInput(); + httpInput.setMultiparts(multiparts); + HttpInput input = OnapCommandHttpUtils.populateParameters(params, httpInput); + assertTrue(input != null); + } + } -- cgit 1.2.3-korg