@Test public void createDemandTest(){ RequestInfo requestInfo = new RequestInfo(); DemandRequest demandRequest = new DemandRequest(); List<Demand> demands = getdemands(); demandRequest.setDemand(demands); demandRequest.setRequestInfo(requestInfo); DemandResponse demandResponse = new DemandResponse(); demandResponse.setDemands(demands); String hostname = "http: String createPath = "demand-services/demand/_create"; when(propertiesManager.getDemandServiceHostName()).thenReturn(hostname); when(propertiesManager.getCreateDemandSevice()).thenReturn(createPath); when(restTemplate.postForObject(hostname+createPath, demandRequest, DemandResponse.class)).thenReturn(demandResponse); assertTrue(demandResponse.equals(demandRepository.createDemand(demands, requestInfo))); }
public DemandResponse createDemand(List<Demand> demands, RequestInfo requestInfo) { LOGGER.info("DemandRepository createDemand demands:" + demands.toString()); DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getCreateDemandSevice(); return restTemplate.postForObject(url, demandRequest, DemandResponse.class); }
DemandRepository { public DemandResponse createDemand(List<Demand> demands, RequestInfo requestInfo) { LOGGER.info("DemandRepository createDemand demands:" + demands.toString()); DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getCreateDemandSevice(); return restTemplate.postForObject(url, demandRequest, DemandResponse.class); } }
DemandRepository { public DemandResponse createDemand(List<Demand> demands, RequestInfo requestInfo) { LOGGER.info("DemandRepository createDemand demands:" + demands.toString()); DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getCreateDemandSevice(); return restTemplate.postForObject(url, demandRequest, DemandResponse.class); }  }
DemandRepository { public DemandResponse createDemand(List<Demand> demands, RequestInfo requestInfo) { LOGGER.info("DemandRepository createDemand demands:" + demands.toString()); DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getCreateDemandSevice(); return restTemplate.postForObject(url, demandRequest, DemandResponse.class); }  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 createDemand(List<Demand> demands, RequestInfo requestInfo) { LOGGER.info("DemandRepository createDemand demands:" + demands.toString()); DemandRequest demandRequest = new DemandRequest(); demandRequest.setRequestInfo(requestInfo); demandRequest.setDemand(demands); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getCreateDemandSevice(); return restTemplate.postForObject(url, demandRequest, DemandResponse.class); }  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);  }