use of org.folio.rest.core.RestClient in project mod-invoice by folio-org.
the class InvoiceRetrieveServiceTest method positiveGetInvoiceMapTest.
@Test
public void positiveGetInvoiceMapTest() throws IOException, ExecutionException, InterruptedException {
InvoiceService invoiceService = new BaseInvoiceService(new RestClient(), invoiceLineService, orderService);
InvoiceRetrieveService service = new InvoiceRetrieveService(invoiceService);
JsonObject vouchersList = new JsonObject(getMockData(VOUCHERS_LIST_PATH));
List<Voucher> vouchers = vouchersList.getJsonArray("vouchers").stream().map(obj -> ((JsonObject) obj).mapTo(Voucher.class)).collect(toList());
vouchers.remove(1);
VoucherCollection voucherCollection = new VoucherCollection();
voucherCollection.setVouchers(vouchers);
CompletableFuture<Map<String, Invoice>> future = service.getInvoiceMap(voucherCollection, new RequestContext(context, okapiHeaders));
Map<String, Invoice> lineMap = future.get();
Assertions.assertEquals(3, lineMap.values().size());
}
Aggregations