diff options
author | 2019-09-06 16:54:05 +0800 | |
---|---|---|
committer | 2019-10-14 06:53:05 +0000 | |
commit | 18a1d2bb8e8a937ee42120b736faec37a2a86aef (patch) | |
tree | 942be1b77698708387190900a6dda24f24dc356a /vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap | |
parent | a671d6f99e5533e729015f3bba74b36d03a890f4 (diff) |
modify Sonar Issue
Issue-ID: VNFSDK-462
Signed-off-by: Hailong Zhang <zhanghailong22@huawei.com>
Change-Id: Icd334b2305258a15a425e50e8028922f4184077e
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap')
3 files changed, 29 insertions, 8 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java index e04af4fa..75d221c7 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; +import autovalue.shaded.org.apache.commons.lang.ObjectUtils; import org.junit.Before; import org.junit.Test; import org.onap.vnfsdk.marketplace.filemanage.http.ToolUtil; diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java index 086d0aed..dbcdfd9c 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java @@ -50,7 +50,7 @@ public class FunctionTestExceutorTest { } - + @Test public void testExecFunctionTest2() { new MockUp<MsbDetailsHolder>() { @Mock diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java index 0452e32d..19bbe692 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java @@ -1208,22 +1208,34 @@ public class PackageResourceTest { public void testisTrimedEmptyString() { boolean res = ToolUtil.isTrimedEmptyString(null); assertEquals(res, true); - res = ToolUtil.isTrimedEmptyString(" "); + res = ToolUtil.isTrimedEmptyString(" huawei "); + assertEquals(res, false); + + } + @Test + public void testisTrimedEmptyArray() { + boolean res = ToolUtil.isTrimedEmptyArray(null); assertEquals(res, true); + String[] String1={"hua","wei"}; + res = ToolUtil.isTrimedEmptyArray(String1); + assertEquals(res, false); } @Test public void testisEmptyCollection() { - - boolean res = ToolUtil.isEmptyCollection(new ArrayList()); + ArrayList arr1 = new ArrayList(); + boolean res = ToolUtil.isEmptyCollection(arr1); assertEquals(res, true); + arr1.add("huawei"); + res = ToolUtil.isEmptyCollection(arr1); + assertEquals(res, false); } @Test public void testisYamlFile() { - File fileObj = new File("test.txt"); + File fileObj = new File("test.yaml"); boolean res = ToolUtil.isYamlFile(fileObj); - assertEquals(res, false); + assertEquals(res, true); } @Test @@ -1234,9 +1246,14 @@ public class PackageResourceTest { @Test public void testgetFormatFileSize() { - String res = ToolUtil.getFormatFileSize(10000000); + long fileSize = 1000*1000*1000*100; + String res = ToolUtil.getFormatFileSize(fileSize); + assertNotNull(res); + res = ToolUtil.getFormatFileSize(1000000000); assertNotNull(res); - res = ToolUtil.getFormatFileSize(10000); + res = ToolUtil.getFormatFileSize(200000); + assertNotNull(res); + res = ToolUtil.getFormatFileSize(100000); assertNotNull(res); res = ToolUtil.getFormatFileSize(100); assertNotNull(res); @@ -1257,6 +1274,8 @@ public class PackageResourceTest { assertNotNull(res); res = ToolUtil.processFileName("abc.zip"); assertNotNull(res); + res = ToolUtil.processFileName("abc"); + assertNotNull(res); } @Test @@ -1326,6 +1345,7 @@ public class PackageResourceTest { @Test public void testToolUtildeleteFile() { + boolean res = ToolUtil.deleteFile("src/test/resources", "TestOut.txt"); assertEquals(res, true); } |