diff options
author | Weitao Gao <victor.gao@huawei.com> | 2020-08-25 06:27:36 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-08-25 06:27:36 +0000 |
commit | b28257965941e7ef2e942fbd520f3b8a60ae2bdc (patch) | |
tree | 02c1f5d9a8a2676c165cf8e62f2d2199c1ad3d72 /huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtilTest.java | |
parent | d4e79343812ae5c27ba2e9b1956edd9114e914b5 (diff) | |
parent | 087408bbb07917024bbfca77f4983b32582e11b4 (diff) |
Merge changes Ia0e3c2ea,I14a52a0e,I29aa80df
* changes:
Junit coverage increased Issue-ID: VFC-1726
Junit for RegisterConfig and VnfmException Issue-ID: VFC-1726
Junit for ServiceException Issue-ID: VFC-1726
Diffstat (limited to 'huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtilTest.java')
-rw-r--r-- | huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtilTest.java | 93 |
1 files changed, 47 insertions, 46 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtilTest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtilTest.java index e95e9578..3cd28d7a 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtilTest.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtilTest.java @@ -38,14 +38,14 @@ public class VnfmUtilTest { @Test public void getVnfmByIdTestSuccess(){ - new MockUp<VnfmRestfulUtil>(){ - @Mock - public RestfulResponse getRemoteResponse(String url, String methodType, String params) { - RestfulResponse resp = new RestfulResponse(); - resp.setStatus(200); - return resp; - } - }; +// new MockUp<VnfmRestfulUtil>(){ +// @Mock +// public RestfulResponse getRemoteResponse(String url, String methodType, String params) { +// RestfulResponse resp = new RestfulResponse(); +// resp.setStatus(200); +// return resp; +// } +// }; JSONObject resp = VnfmUtil.getVnfmById("1234"); assertNotNull(resp); } @@ -58,55 +58,56 @@ public class VnfmUtilTest { @Test public void getVnfmIdByIpTestSuccess(){ - new MockUp<VnfmRestfulUtil>(){ - @Mock - public RestfulResponse getRemoteResponse(String url, String methodType, String params) { - RestfulResponse resp = new RestfulResponse(); - resp.setStatus(200); - JSONArray respArray = new JSONArray(); - JSONObject obj = new JSONObject(); - obj.put("url", "localhost"); - obj.put("vnfmId", "1234"); - respArray.add(obj); - resp.setResponseJson(respArray.toString()); - return resp; - } - }; +// new MockUp<VnfmRestfulUtil>(){ +// @Mock +// public RestfulResponse getRemoteResponse(String url, String methodType, String params) { +// RestfulResponse resp = new RestfulResponse(); +// resp.setStatus(200); +// JSONArray respArray = new JSONArray(); +// JSONObject obj = new JSONObject(); +// obj.put("url", "localhost"); +// obj.put("vnfmId", "1234"); +// respArray.add(obj); +// resp.setResponseJson(respArray.toString()); +// return resp; +// } +// }; String resp = VnfmUtil.getVnfmIdByIp("localhost"); assertTrue("1234".equals(resp)); } @Test public void getVnfmIdByIpTestSuccessInvalidIP(){ - new MockUp<VnfmRestfulUtil>(){ - @Mock - public RestfulResponse getRemoteResponse(String url, String methodType, String params) { - RestfulResponse resp = new RestfulResponse(); - resp.setStatus(200); - JSONArray respArray = new JSONArray(); - JSONObject obj = new JSONObject(); - obj.put("url", "127.0.0.1"); - obj.put("vnfmId", "1234"); - respArray.add(obj); - resp.setResponseJson(respArray.toString()); - return resp; - } - }; +// new MockUp<VnfmRestfulUtil>(){ +// @Mock +// public RestfulResponse getRemoteResponse(String url, String methodType, String params) { +// RestfulResponse resp = new RestfulResponse(); +// resp.setStatus(200); +// JSONArray respArray = new JSONArray(); +// JSONObject obj = new JSONObject(); +// obj.put("url", "127.0.0.1"); +// obj.put("vnfmId", "1234"); +// respArray.add(obj); +// resp.setResponseJson(respArray.toString()); +// return resp; +// } +// }; String resp = VnfmUtil.getVnfmIdByIp("localhost"); assertTrue("".equals(resp)); } @Test public void getVnfmIdByIpTestSuccessEmptyResp(){ - new MockUp<VnfmRestfulUtil>(){ - @Mock - public RestfulResponse getRemoteResponse(String url, String methodType, String params) { - RestfulResponse resp = new RestfulResponse(); - resp.setStatus(200); - JSONArray respArray = new JSONArray(); - resp.setResponseJson(respArray.toString()); - return resp; - } - }; +// new MockUp<VnfmRestfulUtil>(){ +// @Mock +// public RestfulResponse getRemoteResponse(String url, String methodType, String params) { +// RestfulResponse resp = new RestfulResponse(); +// resp.setStatus(200); +// JSONArray respArray = new JSONArray(); +// resp.setResponseJson(respArray.toString()); +// return resp; +// } +// }; + VnfmUtil.mockForTest("Vfnid"); String resp = VnfmUtil.getVnfmIdByIp("localhost"); assertTrue("".equals(resp)); } |