### Question:
VfcManager { public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput) throws ApplicationException { LOGGER.info("instantiate ns -> begin"); NsInstantiateReq oRequest = new NsInstantiateReq(); oRequest.setNsInstanceId(nsInstanceId); NsParameters nsParameters = segInput.getNsParameters(); oRequest.setLocationConstraints(nsParameters.getLocationConstraints()); oRequest.setAdditionalParamForNs(nsParameters.getAdditionalParamForNs()); String instReq = JsonUtil.marshal(oRequest); String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE); String methodType = CommonConstant.MethodType.POST; RestfulResponse instRsp = restfulUtil.send(url, methodType, instReq); ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); ValidateUtil.assertObjectNotNull(instRsp); if (!HttpCode.isSucess(instRsp.getStatus())) { LOGGER.error("update segment operation status : fail to instantiate ns"); status.setStatus(RequestsDbConstant.Status.ERROR); status.setErrorCode(String.valueOf(instRsp.getStatus())); status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); resourceOperationStatusRepository.save(status); throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS); } LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus()); LOGGER.info("instantiate ns response content is : {}", instRsp.getResponseContent()); ValidateUtil.assertObjectNotNull(instRsp.getResponseContent()); @SuppressWarnings("unchecked") Map<String, String> rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class); String jobId = rsp.get(CommonConstant.JOB_ID); if (ValidateUtil.isStrEmpty(jobId)) { LOGGER.error("Invalid jobId from instantiate operation"); status.setStatus(RequestsDbConstant.Status.ERROR); status.setErrorCode(String.valueOf(instRsp.getStatus())); status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED); resourceOperationStatusRepository.save(status); throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION); } LOGGER.info("instantiate ns -> end"); LOGGER.info("update resource operation status job id -> begin"); status.setJobId(jobId); status.setProgress("100"); status.setStatusDescription("NS initiation completed."); resourceOperationStatusRepository.save(status); LOGGER.info("update segment operation job id -> end"); return instRsp; } VfcManager(); RestfulResponse createNs(NSResourceInputParameter segInput); RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId); RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput); RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId); RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId); RestfulResponse scaleNs(String nsInstanceId, NSResourceInputParameter segInput);  }### Answer:
@Test public void instantiateNs() throws Exception { RestfulResponse restfulResponse = new RestfulResponse(); restfulResponse.setStatus(HttpStatus.OK.value()); restfulResponse.setResponseContent("{\"" + CommonConstant.JOB_ID + "\": \"someJobId\"}"); when(restfulUtil.send(any(), any(), any())).thenReturn(restfulResponse); NsParameters nsParameters = new NsParameters(); NSResourceInputParameter segInput = new NSResourceInputParameter(); segInput.setNsParameters(nsParameters); segInput.setNsOperationKey(new NsOperationKey()); RestfulResponse response = vfcManager.instantiateNs("someNsInstanceId", segInput); assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus()); }