Search in sources :

Example 6 with SavingsActivityEntity

use of org.mifos.accounts.savings.business.SavingsActivityEntity in project head by mifos.

the class SavingsBOIntegrationTest method testGetRecentAccountActivity.

@Test
public void testGetRecentAccountActivity() throws Exception {
    createInitialObjects();
    savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
    savings = helper.createSavingsAccount("000100000000017", savingsOffering, group, AccountStates.SAVINGS_ACC_APPROVED, userContext);
    SavingsActivityEntity savingsActivity = new SavingsActivityEntity(savings.getPersonnel(), (AccountActionEntity) StaticHibernateUtil.getSessionTL().get(AccountActionEntity.class, Short.valueOf("1")), new Money(getCurrency(), "100"), new Money(getCurrency(), "22"), new Date(), savings);
    savings.addSavingsActivityDetails(savingsActivity);
    savings.update();
    StaticHibernateUtil.flushAndClearSession();
    savings = savingsDao.findById(savings.getAccountId());
    savings.setUserContext(userContext);
    Assert.assertEquals(1, savings.getRecentAccountActivity(3).size());
    for (SavingsRecentActivityDto view : savings.getRecentAccountActivity(3)) {
        Assert.assertNotNull(view.getActivity());
        Assert.assertEquals(new Money(getCurrency(), "100.0"), new Money(getCurrency(), view.getAmount()));
        Assert.assertEquals(new Money(getCurrency(), "22.0"), new Money(getCurrency(), view.getRunningBalance()));
        Assert.assertNotNull(view.getAccountTrxnId());
        Assert.assertEquals(DateUtils.getCurrentDateWithoutTimeStamp(), DateUtils.getDateWithoutTimeStamp(view.getActionDate().getTime()));
        Assert.assertNull(view.getLocale());
        break;
    }
    group = savings.getCustomer();
    center = group.getParentCustomer();
}
Also used : Money(org.mifos.framework.util.helpers.Money) SavingsRecentActivityDto(org.mifos.dto.screen.SavingsRecentActivityDto) SavingsActivityEntity(org.mifos.accounts.savings.business.SavingsActivityEntity) Date(java.util.Date) Test(org.junit.Test)

Aggregations

SavingsActivityEntity (org.mifos.accounts.savings.business.SavingsActivityEntity)6 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)4 PersonnelBuilder (org.mifos.domain.builders.PersonnelBuilder)4 SavingsAccountBuilder (org.mifos.domain.builders.SavingsAccountBuilder)4 Money (org.mifos.framework.util.helpers.Money)3 DateTime (org.joda.time.DateTime)2 InterestCalculationPeriodResult (org.mifos.accounts.savings.interest.InterestCalculationPeriodResult)2 InterestCalculationPeriodResultBuilder (org.mifos.accounts.savings.interest.InterestCalculationPeriodResultBuilder)2 InterestPostingPeriodResult (org.mifos.accounts.savings.interest.InterestPostingPeriodResult)2 InterestPostingPeriodResultBuilder (org.mifos.accounts.savings.interest.InterestPostingPeriodResultBuilder)2 InterestScheduledEvent (org.mifos.accounts.savings.interest.schedule.InterestScheduledEvent)2 MonthlyOnLastDayOfMonthInterestScheduledEvent (org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent)2 Date (java.util.Date)1 LocalDate (org.joda.time.LocalDate)1 AccountBO (org.mifos.accounts.business.AccountBO)1 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)1 SavingsRecentActivityDto (org.mifos.dto.screen.SavingsRecentActivityDto)1