use of org.mifos.customers.center.persistence.CenterPersistence in project head by mifos.
the class CenterBOIntegrationTest method testSuccessfulCreate.
@Test
public void testSuccessfulCreate() throws Exception {
String name = "Center";
String externalId = "12345";
Date mfiJoiningDate = getDate("11/12/2005");
meeting = getMeeting();
List<FeeDto> fees = getFees();
center = new CenterBO(TestUtils.makeUser(), name, null, getCustomFields(), fees, externalId, mfiJoiningDate, new OfficePersistence().getOffice(officeId), meeting, legacyPersonnelDao.getPersonnel(personnelId), new CustomerPersistence());
new CenterPersistence().saveCenter(center);
StaticHibernateUtil.flushSession();
center = TestObjectFactory.getCenter(center.getCustomerId());
Assert.assertEquals(name, center.getDisplayName());
Assert.assertEquals(externalId, center.getExternalId());
Assert.assertEquals(mfiJoiningDate, DateUtils.getDateWithoutTimeStamp(center.getMfiJoiningDate().getTime()));
Assert.assertEquals(officeId, center.getOffice().getOfficeId());
Assert.assertEquals(2, center.getCustomFields().size());
Assert.assertEquals(AccountState.CUSTOMER_ACCOUNT_ACTIVE.getValue(), center.getCustomerAccount().getAccountState().getId());
// check if values in account fees are entered.
Assert.assertNotNull(center.getCustomerAccount().getAccountFees(fees.get(0).getFeeIdValue()));
Assert.assertNotNull(center.getCustomerAccount().getAccountFees(fees.get(1).getFeeIdValue()));
}
Aggregations