use of org.folio.rest.jaxrs.model.VoucherCollection 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());
}
use of org.folio.rest.jaxrs.model.VoucherCollection in project mod-invoice by folio-org.
the class VoucherLinesRetrieveServiceTest method positiveGetInvoiceMapTest.
@Test
public void positiveGetInvoiceMapTest() throws IOException, ExecutionException, InterruptedException {
VoucherLinesRetrieveService service = new VoucherLinesRetrieveService(okapiHeaders, context, "en");
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, List<VoucherLine>>> future = service.getVoucherLinesMap(voucherCollection);
Map<String, List<VoucherLine>> lineMap = future.get();
Assertions.assertEquals(3, lineMap.get("a9b99f8a-7100-47f2-9903-6293d44a9905").size());
}
Aggregations