use of org.mifos.accounts.business.AccountStateFlagEntity 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