use of org.folio.rest.acq.model.orders.OrderInvoiceRelationship in project mod-invoice by folio-org.
the class OrderServiceTest method shouldDeleteOrderInvoiceRelationshipByInvoiceIdAndLineIdIfRelationExist.
@Test
void shouldDeleteOrderInvoiceRelationshipByInvoiceIdAndLineIdIfRelationExist() {
String invoiceId = UUID.randomUUID().toString();
String poLineId = UUID.randomUUID().toString();
String orderId = UUID.randomUUID().toString();
CompositePoLine poLine = new CompositePoLine().withId(poLineId).withPurchaseOrderId(orderId);
OrderInvoiceRelationship relationship = new OrderInvoiceRelationship().withInvoiceId(invoiceId).withPurchaseOrderId(orderId);
OrderInvoiceRelationshipCollection relationships = new OrderInvoiceRelationshipCollection().withOrderInvoiceRelationships(List.of(relationship)).withTotalRecords(1);
doReturn(completedFuture(poLine)).when(restClient).get(any(RequestEntry.class), eq(requestContextMock), eq(CompositePoLine.class));
doReturn(completedFuture(relationships)).when(restClient).get(any(RequestEntry.class), eq(requestContextMock), eq(OrderInvoiceRelationshipCollection.class));
doReturn(completedFuture(null)).when(restClient).delete(any(RequestEntry.class), eq(requestContextMock));
doReturn(completedFuture(poLine)).when(orderLineService).getPoLine(poLineId, requestContextMock);
orderService.deleteOrderInvoiceRelationshipByInvoiceIdAndLineId(invoiceId, poLineId, requestContextMock).join();
verify(restClient).delete(any(RequestEntry.class), eq(requestContextMock));
}
use of org.folio.rest.acq.model.orders.OrderInvoiceRelationship in project mod-invoice by folio-org.
the class OrderServiceTest method shouldDeleteOrderInvoiceRelationshipByInvoiceIdIfRelationExist.
@Test
void shouldDeleteOrderInvoiceRelationshipByInvoiceIdIfRelationExist() {
String invoiceId = UUID.randomUUID().toString();
String orderId = UUID.randomUUID().toString();
OrderInvoiceRelationship relationship = new OrderInvoiceRelationship().withInvoiceId(invoiceId).withPurchaseOrderId(orderId);
OrderInvoiceRelationshipCollection relationships = new OrderInvoiceRelationshipCollection().withOrderInvoiceRelationships(List.of(relationship)).withTotalRecords(1);
doReturn(completedFuture(relationships)).when(restClient).get(any(RequestEntry.class), eq(requestContextMock), eq(OrderInvoiceRelationshipCollection.class));
doReturn(completedFuture(null)).when(restClient).delete(any(RequestEntry.class), eq(requestContextMock));
orderService.deleteOrderInvoiceRelationshipByInvoiceId(invoiceId, requestContextMock).join();
verify(restClient).delete(any(RequestEntry.class), eq(requestContextMock));
}
Aggregations