diff options
author | arun chapagain <arun.chapagain@huawei.com> | 2020-08-21 20:22:00 +0530 |
---|---|---|
committer | arun chapagain <arun.chapagain@huawei.com> | 2020-08-21 20:22:00 +0530 |
commit | 087408bbb07917024bbfca77f4983b32582e11b4 (patch) | |
tree | 7d40279619992266b2e6afa433f79cd951a70bc5 /huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtilTest.java | |
parent | 29bfc15ca573151581e9da09efaab9a847380284 (diff) |
Junit coverage increased
Issue-ID: VFC-1726
Signed-off-by: arun chapagain <arun.chapagain@huawei.com>
Change-Id: Ia0e3c2ea3ae429e286e9151f2e6de9e3f639c868
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)); } |