summaryrefslogtreecommitdiffstats
path: root/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java')
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java45
1 files changed, 38 insertions, 7 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java
index 0dc6751b..3e93f2c2 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java
@@ -16,10 +16,9 @@
package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.ResultRequestUtil;
import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.connect.ConnectMgrVnfm;
import mockit.Mock;
@@ -29,14 +28,15 @@ import net.sf.json.JSONObject;
public class ResultRequestUtilTest {
@Test
- public void callTestInternalError(){
- new MockUp<ConnectMgrVnfm>(){
+ public void callTestInternalError() {
+ new MockUp<ConnectMgrVnfm>() {
+
@Mock
public int connect(JSONObject vnfmObj) {
return 500;
}
};
- JSONObject vnfmObject = new JSONObject();;
+ JSONObject vnfmObject = new JSONObject();
String path = "http://localhost:8080";
String methodName = "get";
String paramsJson = "";
@@ -45,8 +45,9 @@ public class ResultRequestUtilTest {
}
@Test
- public void callTestConnectionErrot(){
- new MockUp<ConnectMgrVnfm>(){
+ public void callTestConnectionErrot() {
+ new MockUp<ConnectMgrVnfm>() {
+
@Mock
public int connect(JSONObject vnfmObj) {
return 200;
@@ -61,4 +62,34 @@ public class ResultRequestUtilTest {
assertTrue(resp.get("data").equals("get connection error"));
}
+ @Test
+ public void callTest() {
+ new MockUp<ConnectMgrVnfm>() {
+
+ @Mock
+ public int connect(JSONObject vnfmObj) {
+ return 200;
+ }
+
+ @Mock
+ public String getRoaRand() {
+ return "1234";
+ }
+
+ @Mock
+ public String getAccessSession() {
+ return "1234";
+ }
+
+ };
+
+ JSONObject vnfmObject = new JSONObject();
+ vnfmObject.put("url", "/test/123");
+ String path = "https://localhost:8080/%s";
+ String methodName = "get";
+ String paramsJson = "";
+ JSONObject resp = ResultRequestUtil.call(vnfmObject, path, methodName, paramsJson);
+ assertTrue(resp.get("data").equals("get connection error"));
+ }
+
}