@Test public void createBillAndGetXmlTest() { RequestInfo requestInfo = new RequestInfo(); BillRequest billRequest = new BillRequest(); List<BillInfo> billInfos = getBillInfos(); billRequest.setRequestInfo(requestInfo); billRequest.setBillInfos(billInfos); BillResponse billResponse = new BillResponse(); String billXml = "billXml"; List<String> billXmls = new ArrayList<>(); billXmls.add(billXml); billResponse.setBillXmls(billXmls); String url = "host/_create"; when(propertiesManager.getDemandServiceHostName()).thenReturn("host/"); when(propertiesManager.getDemandBillCreateService()).thenReturn("_create"); when(restTemplate.postForObject(url, billRequest, BillResponse.class)).thenReturn(billResponse); assertTrue(billXml.equals(billRepository.createBillAndGetXml(billInfos, requestInfo))); }
public String createBillAndGetXml(List<BillInfo> billInfos, RequestInfo requestInfo) { BillRequest billRequest = new BillRequest(); billRequest.setRequestInfo(requestInfo); billRequest.setBillInfos(billInfos); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getDemandBillCreateService(); LOGGER.info("billRequest url ++++++++++++ " + url); BillResponse billResponse = restTemplate.postForObject(url, billRequest, BillResponse.class); LOGGER.info("billResponse>>>>>>>>>>" + billResponse.getBillXmls()); if (billResponse.getBillXmls().isEmpty()) { LOGGER.info("exception occured while getting billInfo"); throw new CollectionExceedException(); } else return billResponse.getBillXmls().get(0); }
BillRepository { public String createBillAndGetXml(List<BillInfo> billInfos, RequestInfo requestInfo) { BillRequest billRequest = new BillRequest(); billRequest.setRequestInfo(requestInfo); billRequest.setBillInfos(billInfos); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getDemandBillCreateService(); LOGGER.info("billRequest url ++++++++++++ " + url); BillResponse billResponse = restTemplate.postForObject(url, billRequest, BillResponse.class); LOGGER.info("billResponse>>>>>>>>>>" + billResponse.getBillXmls()); if (billResponse.getBillXmls().isEmpty()) { LOGGER.info("exception occured while getting billInfo"); throw new CollectionExceedException(); } else return billResponse.getBillXmls().get(0); } }
BillRepository { public String createBillAndGetXml(List<BillInfo> billInfos, RequestInfo requestInfo) { BillRequest billRequest = new BillRequest(); billRequest.setRequestInfo(requestInfo); billRequest.setBillInfos(billInfos); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getDemandBillCreateService(); LOGGER.info("billRequest url ++++++++++++ " + url); BillResponse billResponse = restTemplate.postForObject(url, billRequest, BillResponse.class); LOGGER.info("billResponse>>>>>>>>>>" + billResponse.getBillXmls()); if (billResponse.getBillXmls().isEmpty()) { LOGGER.info("exception occured while getting billInfo"); throw new CollectionExceedException(); } else return billResponse.getBillXmls().get(0); }  }
BillRepository { public String createBillAndGetXml(List<BillInfo> billInfos, RequestInfo requestInfo) { BillRequest billRequest = new BillRequest(); billRequest.setRequestInfo(requestInfo); billRequest.setBillInfos(billInfos); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getDemandBillCreateService(); LOGGER.info("billRequest url ++++++++++++ " + url); BillResponse billResponse = restTemplate.postForObject(url, billRequest, BillResponse.class); LOGGER.info("billResponse>>>>>>>>>>" + billResponse.getBillXmls()); if (billResponse.getBillXmls().isEmpty()) { LOGGER.info("exception occured while getting billInfo"); throw new CollectionExceedException(); } else return billResponse.getBillXmls().get(0); }  String createBillAndGetXml(List<BillInfo> billInfos, RequestInfo requestInfo); BillResponse updateBill(List<BillInfo> billInfos, RequestInfo requestInfo); BillInfo searchBill(BillSearchCriteria billSearchCriteria, RequestInfo requestInfo); Map getPurpose(String tenantId); }
BillRepository { public String createBillAndGetXml(List<BillInfo> billInfos, RequestInfo requestInfo) { BillRequest billRequest = new BillRequest(); billRequest.setRequestInfo(requestInfo); billRequest.setBillInfos(billInfos); String url = propertiesManager.getDemandServiceHostName() + propertiesManager.getDemandBillCreateService(); LOGGER.info("billRequest url ++++++++++++ " + url); BillResponse billResponse = restTemplate.postForObject(url, billRequest, BillResponse.class); LOGGER.info("billResponse>>>>>>>>>>" + billResponse.getBillXmls()); if (billResponse.getBillXmls().isEmpty()) { LOGGER.info("exception occured while getting billInfo"); throw new CollectionExceedException(); } else return billResponse.getBillXmls().get(0); }  String createBillAndGetXml(List<BillInfo> billInfos, RequestInfo requestInfo); BillResponse updateBill(List<BillInfo> billInfos, RequestInfo requestInfo); BillInfo searchBill(BillSearchCriteria billSearchCriteria, RequestInfo requestInfo); Map getPurpose(String tenantId);  }