use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class IncomingInvoiceItemRepository_IntegTest method findByInvoiceAndChargeAndSequence_works.
@Test
public void findByInvoiceAndChargeAndSequence_works() throws Exception {
// given
IncomingInvoice invoice = createIncomingInvoiceAndTwoItemsWithSameCharge();
// when
Charge chargeToFindOnItem = charge;
IncomingInvoiceItem item1 = incomingInvoiceItemRepository.findByInvoiceAndChargeAndSequence(invoice, chargeToFindOnItem, BigInteger.valueOf(1L));
IncomingInvoiceItem item2 = incomingInvoiceItemRepository.findByInvoiceAndChargeAndSequence(invoice, chargeToFindOnItem, BigInteger.valueOf(2L));
// then
assertThat(item1.getInvoice()).isEqualTo(invoice);
assertThat(item1.getCharge()).isEqualTo(charge);
assertThat(item1.getSequence()).isEqualTo(BigInteger.valueOf(1L));
assertThat(item2.getInvoice()).isEqualTo(invoice);
assertThat(item2.getCharge()).isEqualTo(charge);
assertThat(item2.getSequence()).isEqualTo(BigInteger.valueOf(2L));
// and when
Charge chargeNotToBeFoundOnItem = chargeRepository.findByReference("OTHER");
IncomingInvoiceItem itemNotToBeFound = incomingInvoiceItemRepository.findByInvoiceAndChargeAndSequence(invoice, chargeNotToBeFoundOnItem, BigInteger.valueOf(1L));
// then
assertThat(itemNotToBeFound).isNull();
}
use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class IncomingInvoiceItemRepository_IntegTest method createIncomingInvoiceAndTwoItemsWithSameCharge.
private IncomingInvoice createIncomingInvoiceAndTwoItemsWithSameCharge() {
seller = OrganisationAndComms_enum.TopModelGb.findUsing(serviceRegistry);
buyer = OrganisationAndComms_enum.HelloWorldGb.findUsing(serviceRegistry);
property = propertyRepository.findPropertyByReference(Property_enum.OxfGb.getRef());
invoiceNumber = "123";
invoiceDate = new LocalDate(2017, 1, 1);
dueDate = invoiceDate.minusMonths(1);
paymentMethod = PaymentMethod.BANK_TRANSFER;
invoiceStatus = InvoiceStatus.NEW;
atPath = "/GBR";
IncomingInvoice invoice = incomingInvoiceRepository.create(IncomingInvoiceType.CAPEX, invoiceNumber, property, atPath, buyer, seller, invoiceDate, dueDate, paymentMethod, invoiceStatus, null, null, IncomingInvoiceApprovalState.PAID);
charge = chargeRepository.findByReference("WORKS");
description = "some description";
tax = taxRepository.findByReference("FRF");
invoice.addItem(invoice.getType(), charge, description, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, tax, dueDate, null, null, null, null);
invoice.addItem(invoice.getType(), charge, description, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, tax, dueDate, null, null, null, null);
return invoice;
}
Aggregations