use of org.mifos.accounts.business.AccountStateEntity in project head by mifos.
the class SavingsScheduleTest method whenASavingsScheduleForAnActiveSavingsAccountIsCreatedDepositEqualsTheAccountRecommendedAmount.
@Test
public void whenASavingsScheduleForAnActiveSavingsAccountIsCreatedDepositEqualsTheAccountRecommendedAmount() {
AccountStateEntity savingsAccountState = new AccountStateEntity(AccountState.SAVINGS_ACTIVE);
// stubbing
when(savingsAccount.getAccountState()).thenReturn(savingsAccountState);
// exercise
savingsSchedule = new SavingsScheduleBuilder().withInstallmentNumber(1).withAccount(savingsAccount).withCustomer(payingCustomer).withDepositDue(recommendedAmount).build();
// verification
assertThat(savingsSchedule.getDeposit(), is(recommendedAmount));
}
use of org.mifos.accounts.business.AccountStateEntity in project head by mifos.
the class SavingsPaymentStrategyForMandatorySavingsAccountsTest method setupMifosLoggerDueToUseOfStaticClientRules.
@BeforeClass
public static void setupMifosLoggerDueToUseOfStaticClientRules() {
defaultCurrency = TestUtils.RUPEE;
Money.setDefaultCurrency(defaultCurrency);
savingsAccountState = new AccountStateEntity(AccountState.SAVINGS_ACTIVE);
}
use of org.mifos.accounts.business.AccountStateEntity in project head by mifos.
the class SavingsPersistenceIntegrationTest method testGetAccountStatus.
@Test
public void testGetAccountStatus() throws Exception {
AccountStateEntity accountState = savingsPersistence.getAccountStatusObject(AccountStates.SAVINGS_ACC_CLOSED);
Assert.assertNotNull(accountState);
Assert.assertEquals(accountState.getId().shortValue(), AccountStates.SAVINGS_ACC_CLOSED);
}
use of org.mifos.accounts.business.AccountStateEntity in project head by mifos.
the class AccountStateIntegrationTest method testRetrieveAllAccountStateList.
/*
* Check that the values in the enumerated type AccountState match with the
* Entity values in terms of ids, state names, and the text that they
* eventually resolve to.
*/
@Test
public void testRetrieveAllAccountStateList() throws NumberFormatException, PersistenceException {
List<AccountStateEntity> accountStateEntityList = legacyAccountDao.retrieveAllAccountStateList(ProductType.SAVINGS.getValue());
Assert.assertNotNull(accountStateEntityList);
Assert.assertEquals(6, accountStateEntityList.size());
List<AccountStateEntity> accountStateEntityList2 = legacyAccountDao.retrieveAllAccountStateList(ProductType.LOAN.getValue());
Assert.assertNotNull(accountStateEntityList2);
Assert.assertEquals(12, accountStateEntityList2.size());
accountStateEntityList.addAll(accountStateEntityList2);
// order by id
Collections.sort(accountStateEntityList, new Comparator<AccountStateEntity>() {
@Override
public int compare(AccountStateEntity state1, AccountStateEntity state2) {
return state1.getId().compareTo(state2.getId());
}
});
Assert.assertEquals(AccountState.values().length, accountStateEntityList.size());
Iterator<AccountStateEntity> stateListIterator = accountStateEntityList.iterator();
for (AccountState state : AccountState.values()) {
AccountStateEntity stateInDatabase = stateListIterator.next();
Assert.assertEquals(state.getValue(), stateInDatabase.getId());
Assert.assertEquals(state.getPropertiesKey(), stateInDatabase.getLookUpValue().getLookUpName());
Assert.assertEquals(ApplicationContextProvider.getBean(MessageLookup.class).lookup(state), ApplicationContextProvider.getBean(MessageLookup.class).lookup(stateInDatabase));
}
}
use of org.mifos.accounts.business.AccountStateEntity in project head by mifos.
the class SavingsBOIntegrationTest method testSuccessfulFlagSave.
@Test
public void testSuccessfulFlagSave() throws Exception {
Session session = StaticHibernateUtil.getSessionTL();
StaticHibernateUtil.startTransaction();
createInitialObjects();
savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
savings = helper.createSavingsAccount("000X00000000013", savingsOffering, group, AccountStates.SAVINGS_ACC_APPROVED, userContext);
savings.setUserContext(TestObjectFactory.getContext());
PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
savings.changeStatus(AccountState.SAVINGS_CANCELLED, null, "", loggedInUser);
savings.setUserContext(this.userContext);
AccountStateEntity state = (AccountStateEntity) session.get(AccountStateEntity.class, (short) 15);
for (AccountStateFlagEntity flag : state.getFlagSet()) {
AccountTestUtils.addAccountFlag(flag, savings);
}
savings.update();
session = StaticHibernateUtil.getSessionTL();
SavingsBO savingsNew = (SavingsBO) (session.get(SavingsBO.class, Integer.valueOf(savings.getAccountId())));
Assert.assertEquals(savingsNew.getAccountFlags().size(), 3);
session.evict(savingsNew);
}
Aggregations