@Test public void updateDemandTest(){ DemandRequest demandRequest = new DemandRequest(); RequestInfo requestInfo = new RequestInfo(); List<Demand> demands = getdemands(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); DemandResponse demandResponse = new DemandResponse(); demandResponse.setDemands(demands); String url = "http: when(propertiesManager.getDemandServiceHostName()).thenReturn("http: when(propertiesManager.getUpdateDemandBasePath()).thenReturn("demand-services/demand/"); when(propertiesManager.getUpdateDemandService()).thenReturn("_update"); when(restTemplate.postForObject(url, demandRequest, DemandResponse.class)).thenReturn(demandResponse); assertTrue(demandResponse.equals(demandRepository.updateDemand(demands, requestInfo))); }
public DemandResponse updateDemand(List<Demand> demands, RequestInfo requestInfo) { DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getUpdateDemandBasePath() + propertiesManager.getUpdateDemandService(); LOGGER.info("the url for update demand API call is ::: " + url); DemandResponse demandResponse = null; try { demandResponse = restTemplate.postForObject(url, demandRequest, DemandResponse.class); } catch (Exception e) { LOGGER.info("the exception raised during update demand API call ::: " + e); } LOGGER.info("the exception raised during update demand API call ::: " + demandResponse); return demandResponse; }
DemandRepository { public DemandResponse updateDemand(List<Demand> demands, RequestInfo requestInfo) { DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getUpdateDemandBasePath() + propertiesManager.getUpdateDemandService(); LOGGER.info("the url for update demand API call is ::: " + url); DemandResponse demandResponse = null; try { demandResponse = restTemplate.postForObject(url, demandRequest, DemandResponse.class); } catch (Exception e) { LOGGER.info("the exception raised during update demand API call ::: " + e); } LOGGER.info("the exception raised during update demand API call ::: " + demandResponse); return demandResponse; } }
DemandRepository { public DemandResponse updateDemand(List<Demand> demands, RequestInfo requestInfo) { DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getUpdateDemandBasePath() + propertiesManager.getUpdateDemandService(); LOGGER.info("the url for update demand API call is ::: " + url); DemandResponse demandResponse = null; try { demandResponse = restTemplate.postForObject(url, demandRequest, DemandResponse.class); } catch (Exception e) { LOGGER.info("the exception raised during update demand API call ::: " + e); } LOGGER.info("the exception raised during update demand API call ::: " + demandResponse); return demandResponse; }  }
DemandRepository { public DemandResponse updateDemand(List<Demand> demands, RequestInfo requestInfo) { DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getUpdateDemandBasePath() + propertiesManager.getUpdateDemandService(); LOGGER.info("the url for update demand API call is ::: " + url); DemandResponse demandResponse = null; try { demandResponse = restTemplate.postForObject(url, demandRequest, DemandResponse.class); } catch (Exception e) { LOGGER.info("the exception raised during update demand API call ::: " + e); } LOGGER.info("the exception raised during update demand API call ::: " + demandResponse); return demandResponse; }  List<DemandReason> getDemandReason(AgreementRequest agreementRequest); List<DemandReason> getLegacyDemandReason(AgreementRequest agreementRequest); List<Demand> getDemandList(AgreementRequest agreementRequest, List<DemandReason> demandReasons); DemandResponse createDemand(List<Demand> demands, RequestInfo requestInfo); DemandResponse getDemandBySearch(DemandSearchCriteria demandSearchCriteria, RequestInfo requestInfo); DemandResponse updateDemandForCollection(List<Demand> demands, RequestInfo requestInfo); DemandResponse updateDemandForCollectionWithCancelReceipt(List<Demand> demands, RequestInfo requestInfo); DemandResponse updateDemand(List<Demand> demands, RequestInfo requestInfo); List<DemandReason> getDemandReasonForRenewal(AgreementRequest agreementRequest, boolean isForApproval); }
DemandRepository { public DemandResponse updateDemand(List<Demand> demands, RequestInfo requestInfo) { DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getUpdateDemandBasePath() + propertiesManager.getUpdateDemandService(); LOGGER.info("the url for update demand API call is ::: " + url); DemandResponse demandResponse = null; try { demandResponse = restTemplate.postForObject(url, demandRequest, DemandResponse.class); } catch (Exception e) { LOGGER.info("the exception raised during update demand API call ::: " + e); } LOGGER.info("the exception raised during update demand API call ::: " + demandResponse); return demandResponse; }  List<DemandReason> getDemandReason(AgreementRequest agreementRequest); List<DemandReason> getLegacyDemandReason(AgreementRequest agreementRequest); List<Demand> getDemandList(AgreementRequest agreementRequest, List<DemandReason> demandReasons); DemandResponse createDemand(List<Demand> demands, RequestInfo requestInfo); DemandResponse getDemandBySearch(DemandSearchCriteria demandSearchCriteria, RequestInfo requestInfo); DemandResponse updateDemandForCollection(List<Demand> demands, RequestInfo requestInfo); DemandResponse updateDemandForCollectionWithCancelReceipt(List<Demand> demands, RequestInfo requestInfo); DemandResponse updateDemand(List<Demand> demands, RequestInfo requestInfo); List<DemandReason> getDemandReasonForRenewal(AgreementRequest agreementRequest, boolean isForApproval);  }