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();
}
Aggregations