Add UT for VNFSDK-613 80/112280/1
authorCooper.Wu <wutuo@chinamobile.com>
Tue, 8 Sep 2020 14:02:27 +0000 (22:02 +0800)
committerCooper.Wu <wutuo@chinamobile.com>
Tue, 8 Sep 2020 14:02:38 +0000 (22:02 +0800)
Issue-ID: VNFSDK-613
Change-Id: Ie78001256efa304621043f485d7d31aa442297de
Signed-off-by: Cooper.Wu <wutuo@chinamobile.com>
vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/VTPScenarioResourceTest.java

index f0f0cce..5545779 100644 (file)
@@ -17,6 +17,8 @@ package org.onap.vtp;
 
 import com.google.gson.JsonElement;
 import com.google.gson.JsonParser;
+import org.glassfish.jersey.media.multipart.ContentDisposition;
+import org.glassfish.jersey.media.multipart.FormDataBodyPart;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -37,6 +39,12 @@ public class VTPScenarioResourceTest {
 
     VTPScenarioResource vtpScenarioResource;
 
+    @Mock
+    FormDataBodyPart formDataBodyPart;
+    @Mock
+    ContentDisposition contentDisposition;
+
+
     @Before
     public void setUp() throws Exception {
 
@@ -85,4 +93,32 @@ public class VTPScenarioResourceTest {
     {
         vtpScenarioResource.getTestcaseHandler("open-cli","testsuit","testcase");
     }
+
+    @Test(expected = NullPointerException.class)
+    public void testStorageScenarios() throws Exception
+    {
+        List<FormDataBodyPart> bodyParts = new ArrayList<>();
+        formDataBodyPart.setName("abc");
+        formDataBodyPart.setValue("123");
+        formDataBodyPart.setContentDisposition(contentDisposition);
+        bodyParts.add(formDataBodyPart);
+        vtpScenarioResource.storageScenarios(bodyParts);
+    }
+
+    @Test
+    public void testDeleteScenario() throws Exception
+    {
+        vtpScenarioResource.deleteScenario("demo-registry.yaml");
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testStorageTestcases() throws Exception
+    {
+        List<FormDataBodyPart> bodyParts = new ArrayList<>();
+        formDataBodyPart.setName("abc");
+        formDataBodyPart.setValue("123");
+        formDataBodyPart.setContentDisposition(contentDisposition);
+        bodyParts.add(formDataBodyPart);
+        vtpScenarioResource.storageTestcases(bodyParts);
+    }
 }
\ No newline at end of file