use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class IncomingInvoiceMenu_Test method filterOrFindBySeller_find_works.
@Test
public void filterOrFindBySeller_find_works() {
IncomingInvoiceMenu.IncomingInvoiceFinder builder;
// given
builder = new IncomingInvoiceMenu.IncomingInvoiceFinder(mockInvoiceRepository, mockIncomingInvoiceRepository, mockPartyRepository);
Organisation seller = new Organisation();
// expect
context.checking(new Expectations() {
{
oneOf(mockPartyRepository).findParties("*abc*");
will(returnValue(Arrays.asList(seller)));
oneOf(mockInvoiceRepository).findBySeller(seller);
}
});
// when
builder.filterOrFindBySeller("abc");
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class OrderRepository_Test method upsert_when_already_exists.
@Test
public void upsert_when_already_exists() throws Exception {
// given
OrderRepository orderRepository = new OrderRepository() {
@Override
public Order findByOrderNumber(final String orderNumber) {
return order;
}
};
String number = "some number";
String sellerOrderReference = "ref";
LocalDate entryDate = new LocalDate(2017, 1, 1);
LocalDate orderDate = new LocalDate(2017, 1, 2);
Party seller = new Organisation();
Party buyer = new Organisation();
Property property = new Property();
String atPath = "atPath";
OrderApprovalState approvalState = OrderApprovalState.APPROVED;
assertThat(order.getOrderNumber()).isNull();
// when
orderRepository.upsert(property, number, sellerOrderReference, entryDate, orderDate, seller, buyer, atPath, approvalState);
// then
assertThat(order.getOrderNumber()).isNull();
assertThat(order.getSellerOrderReference()).isEqualTo(sellerOrderReference);
assertThat(order.getEntryDate()).isEqualTo(entryDate);
assertThat(order.getOrderDate()).isEqualTo(orderDate);
assertThat(order.getSeller()).isEqualTo(seller);
assertThat(order.getBuyer()).isEqualTo(buyer);
assertThat(order.getProperty()).isEqualTo(property);
assertThat(order.getAtPath()).isEqualTo(atPath);
// is ignored.
assertThat(order.getApprovalState()).isNull();
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class Order_Test method minimalRequiredDataToComplete.
@Test
public void minimalRequiredDataToComplete() throws Exception {
// given
Order order = new Order();
OrderItem item1 = new OrderItem();
order.getItems().add(item1);
// when
String result = order.reasonIncomplete();
// then
assertThat(result).isEqualTo("order number, buyer, seller, (on item) description, charge, start date, end date, net amount, gross amount required");
// and when
order.setOrderNumber("123");
item1.setNetAmount(new BigDecimal("100"));
result = order.reasonIncomplete();
// then
assertThat(result).isEqualTo("buyer, seller, (on item) description, charge, start date, end date, gross amount required");
// and when
order.setBuyer(new Organisation());
order.setSeller(new Organisation());
item1.setDescription("blah");
item1.setGrossAmount(BigDecimal.ZERO);
item1.setCharge(new Charge());
item1.setStartDate(new LocalDate());
item1.setEndDate(new LocalDate());
result = order.reasonIncomplete();
// then
assertThat(result).isNull();
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class PaymentBatch_Test method newOrganisation.
Organisation newOrganisation(final String reference, final String applicationTenancyPath) {
final Organisation organisation = new Organisation() {
@Override
public String getAtPath() {
return applicationTenancyPath;
}
};
organisation.setReference(reference);
organisation.setName(reference + " Organisation");
organisation.setApplicationTenancyPath(applicationTenancyPath);
return organisation;
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class BankAccountRepository_Test method findBankAccountsByOwner_filters_deprecated.
@Test
public void findBankAccountsByOwner_filters_deprecated() throws Exception {
// given
BankAccountRepository repo = new BankAccountRepository();
repo.financialAccountRepository = mockFARepo;
Party party = new Organisation();
BankAccount account1 = new BankAccount();
BankAccount account2 = new BankAccount();
// expect
context.checking(new Expectations() {
{
oneOf(mockFARepo).findAccountsByTypeOwner(FinancialAccountType.BANK_ACCOUNT, party);
will(returnValue(Arrays.asList(account1, account2)));
}
});
// when
List<BankAccount> result = repo.findBankAccountsByOwner(party);
Assertions.assertThat(result.size()).isEqualTo(2);
Assertions.assertThat(result).contains(account1);
Assertions.assertThat(result).contains(account2);
// and given
account2.setDeprecated(true);
// expect
context.checking(new Expectations() {
{
oneOf(mockFARepo).findAccountsByTypeOwner(FinancialAccountType.BANK_ACCOUNT, party);
will(returnValue(Arrays.asList(account1, account2)));
}
});
// when
result = repo.findBankAccountsByOwner(party);
Assertions.assertThat(result.size()).isEqualTo(1);
Assertions.assertThat(result).contains(account1);
Assertions.assertThat(result).doesNotContain(account2);
}
Aggregations