Search in sources :

Example 1 with CustomerMovementEntity

use of org.mifos.customers.business.CustomerMovementEntity in project head by mifos.

the class ClientIntegrationTest method testUpdateBranchSecondTime.

@Test
public void testUpdateBranchSecondTime() throws Exception {
    StaticHibernateUtil.closeSession();
    createObjectsForClientTransfer();
    Assert.assertNull(client.getActiveCustomerMovement());
    OfficeBO oldOffice = client.getOffice();
    client.transferToBranch(office);
    StaticHibernateUtil.flushSession();
    client = TestObjectFactory.getClient(client.getCustomerId());
    client.setUserContext(TestUtils.makeUser());
    CustomerMovementEntity currentMovement = client.getActiveCustomerMovement();
    Assert.assertNotNull(currentMovement);
    Assert.assertEquals(office.getOfficeId(), currentMovement.getOffice().getOfficeId());
    Assert.assertEquals(office.getOfficeId(), client.getOffice().getOfficeId());
    client.transferToBranch(oldOffice);
    StaticHibernateUtil.flushSession();
    client = TestObjectFactory.getClient(client.getCustomerId());
    currentMovement = client.getActiveCustomerMovement();
    Assert.assertNotNull(currentMovement);
    Assert.assertEquals(oldOffice.getOfficeId(), currentMovement.getOffice().getOfficeId());
    Assert.assertEquals(oldOffice.getOfficeId(), client.getOffice().getOfficeId());
    office = new OfficePersistence().getOffice(office.getOfficeId());
}
Also used : CustomerMovementEntity(org.mifos.customers.business.CustomerMovementEntity) OfficeBO(org.mifos.customers.office.business.OfficeBO) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CustomerMovementEntity (org.mifos.customers.business.CustomerMovementEntity)1 OfficeBO (org.mifos.customers.office.business.OfficeBO)1 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)1