use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class DebtorBankAccountService_Test method unique_Debtor_Account_To_Pay_works_when_multiple_bankaccounts_one_preferred.
@Test
public void unique_Debtor_Account_To_Pay_works_when_multiple_bankaccounts_one_preferred() throws Exception {
// given
DebtorBankAccountService service = new DebtorBankAccountService();
service.bankAccountRepository = mockBankAccountRepository;
BankAccount bankAccount = new BankAccount();
BankAccount preferredBankAccount = new BankAccount();
preferredBankAccount.setPreferred(true);
List<BankAccount> bankAccounts = new ArrayList<>();
bankAccounts.add(bankAccount);
bankAccounts.add(preferredBankAccount);
IncomingInvoice invoice = new IncomingInvoice();
Party debtor = new Organisation();
invoice.setBuyer(debtor);
// expect
context.checking(new Expectations() {
{
oneOf(mockBankAccountRepository).findBankAccountsByOwner(debtor);
will(returnValue(bankAccounts));
}
});
// when, then
assertThat(service.uniqueDebtorAccountToPay(invoice)).isEqualTo(preferredBankAccount);
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class DebtorBankAccountService_Test method unique_Debtor_Account_To_Pay_works_when_no_bankaccount_and_no_property.
@Test
public void unique_Debtor_Account_To_Pay_works_when_no_bankaccount_and_no_property() throws Exception {
// given
DebtorBankAccountService service = new DebtorBankAccountService();
service.bankAccountRepository = mockBankAccountRepository;
IncomingInvoice invoice = new IncomingInvoice();
Party debtor = new Organisation();
invoice.setBuyer(debtor);
// expect
context.checking(new Expectations() {
{
oneOf(mockBankAccountRepository).findBankAccountsByOwner(debtor);
}
});
// when, then
assertThat(service.uniqueDebtorAccountToPay(invoice)).isNull();
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class DebtorBankAccountService_Test method unique_Debtor_Account_To_Pay_works_when_multiple_bankaccounts_none_preferred.
@Test
public void unique_Debtor_Account_To_Pay_works_when_multiple_bankaccounts_none_preferred() throws Exception {
// given
DebtorBankAccountService service = new DebtorBankAccountService();
service.bankAccountRepository = mockBankAccountRepository;
BankAccount bankAccount1 = new BankAccount();
BankAccount bankAccount2 = new BankAccount();
List<BankAccount> bankAccounts = new ArrayList<>();
bankAccounts.add(bankAccount1);
bankAccounts.add(bankAccount2);
IncomingInvoice invoice = new IncomingInvoice();
Party debtor = new Organisation();
invoice.setBuyer(debtor);
// expect
context.checking(new Expectations() {
{
oneOf(mockBankAccountRepository).findBankAccountsByOwner(debtor);
will(returnValue(bankAccounts));
}
});
// when, then
assertThat(service.uniqueDebtorAccountToPay(invoice)).isNull();
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class IncomingInvoiceMenu_Test method filterOrFindBySeller_filter_works.
@Test
public void filterOrFindBySeller_filter_works() {
IncomingInvoiceMenu.IncomingInvoiceFinder builder;
// given
builder = new IncomingInvoiceMenu.IncomingInvoiceFinder(mockInvoiceRepository, mockIncomingInvoiceRepository, mockPartyRepository);
IncomingInvoice invoice1 = new IncomingInvoice();
Person personToBeFiltered = new Person();
Organisation seller = new Organisation();
invoice1.setSeller(seller);
IncomingInvoice invoice2 = new IncomingInvoice();
builder.setResult(Arrays.asList(invoice1, invoice2));
Assertions.assertThat(builder.getResult().size()).isEqualTo(2);
// expect
context.checking(new Expectations() {
{
oneOf(mockPartyRepository).findParties("*abc*");
will(returnValue(Arrays.asList(seller, personToBeFiltered)));
}
});
// when
builder.filterOrFindBySeller("abc");
// then
Assertions.assertThat(builder.getResult().size()).isEqualTo(1);
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class Order_Test method minimalRequiredDataToComplete_consitent_dimensions_for_property_project.
@Test
public void minimalRequiredDataToComplete_consitent_dimensions_for_property_project() throws Exception {
// given
Order order = new Order();
OrderItem item1 = new OrderItem();
order.getItems().add(item1);
order.setOrderNumber("123");
order.setBuyer(new Organisation());
order.setSeller(new Organisation());
item1.setNetAmount(new BigDecimal("100"));
item1.setDescription("blah");
item1.setGrossAmount(BigDecimal.ZERO);
item1.setCharge(new Charge());
item1.setStartDate(new LocalDate());
item1.setEndDate(new LocalDate());
// when
item1.setProject(new Project());
String result = order.reasonIncomplete();
// then
assertThat(result).isEqualTo("(on item) when project filled in then property required");
}
Aggregations