Search in sources :

Example 16 with AccountNotesEntity

use of org.mifos.accounts.business.AccountNotesEntity in project head by mifos.

the class SavingsCloseTest method whenClosingAccountShouldSetStatusAsClosed.

@Test
public void whenClosingAccountShouldSetStatusAsClosed() {
    Money remainingBalance = TestUtils.createMoney("100");
    savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).withBalanceOf(remainingBalance).build();
    AccountPaymentEntity payment = new AccountPaymentEntityBuilder().with(savingsAccount).with(remainingBalance).build();
    AccountNotesEntity notes = new AccountNotesEntityBuilder().build();
    CustomerBO customer = new ClientBuilder().buildForUnitTests();
    PersonnelBO loggedInUser = new PersonnelBuilder().build();
    // exercise test
    savingsAccount.closeAccount(payment, notes, customer, loggedInUser);
    // verification
    assertTrue(savingsAccount.getAccountState().isInState(AccountState.SAVINGS_CLOSED));
}
Also used : PersonnelBuilder(org.mifos.domain.builders.PersonnelBuilder) Money(org.mifos.framework.util.helpers.Money) AccountNotesEntityBuilder(org.mifos.accounts.business.AccountNotesEntityBuilder) AccountPaymentEntityBuilder(org.mifos.accounts.business.AccountPaymentEntityBuilder) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) AccountNotesEntity(org.mifos.accounts.business.AccountNotesEntity) CustomerBO(org.mifos.customers.business.CustomerBO) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Test(org.junit.Test)

Example 17 with AccountNotesEntity

use of org.mifos.accounts.business.AccountNotesEntity in project head by mifos.

the class SavingsBOIntegrationTest method testGetRecentAccountNotes.

@Test
public void testGetRecentAccountNotes() throws Exception {
    savings = getSavingsAccountForCenter();
    addNotes("note1");
    addNotes("note2");
    addNotes("note3");
    addNotes("note4");
    addNotes("note5");
    StaticHibernateUtil.flushAndClearSession();
    savings = savingsDao.findById(savings.getAccountId());
    List<AccountNotesEntity> notes = savings.getRecentAccountNotes();
    Assert.assertEquals("Size of recent notes is 3", 3, notes.size());
    for (AccountNotesEntity accountNotesEntity : notes) {
        Assert.assertEquals("Last note added is note5", "note5", accountNotesEntity.getComment());
        break;
    }
}
Also used : AccountNotesEntity(org.mifos.accounts.business.AccountNotesEntity) Test(org.junit.Test)

Aggregations

AccountNotesEntity (org.mifos.accounts.business.AccountNotesEntity)17 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)10 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)8 Money (org.mifos.framework.util.helpers.Money)8 Test (org.junit.Test)7 UserContext (org.mifos.security.util.UserContext)7 CustomerBO (org.mifos.customers.business.CustomerBO)6 AccountNotesEntityBuilder (org.mifos.accounts.business.AccountNotesEntityBuilder)5 AccountPaymentEntityBuilder (org.mifos.accounts.business.AccountPaymentEntityBuilder)5 MifosRuntimeException (org.mifos.core.MifosRuntimeException)5 ClientBuilder (org.mifos.domain.builders.ClientBuilder)5 PersonnelBuilder (org.mifos.domain.builders.PersonnelBuilder)5 SavingsAccountBuilder (org.mifos.domain.builders.SavingsAccountBuilder)5 MifosUser (org.mifos.security.MifosUser)5 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 LocalDate (org.joda.time.LocalDate)4 AccountException (org.mifos.accounts.exceptions.AccountException)4 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)4 CustomerNoteDto (org.mifos.dto.domain.CustomerNoteDto)4