Search in sources :

Example 1 with FeeException

use of org.mifos.accounts.fees.exceptions.FeeException in project head by mifos.

the class FeeBO method update.

public void update() throws FeeException {
    try {
        setUpdateDetails();
        ApplicationContextProvider.getBean(LegacyAccountDao.class).createOrUpdate(this);
    } catch (PersistenceException e) {
        throw new FeeException(FeeConstants.FEE_UPDATE_ERROR, e);
    }
}
Also used : FeeException(org.mifos.accounts.fees.exceptions.FeeException) LegacyAccountDao(org.mifos.accounts.persistence.LegacyAccountDao) PersistenceException(org.mifos.framework.exceptions.PersistenceException)

Example 2 with FeeException

use of org.mifos.accounts.fees.exceptions.FeeException in project head by mifos.

the class FeeBOTest method testInvalidConnectionThrowsExceptionInConstructor.

@Test
@ExpectedException(value = FeeException.class)
public void testInvalidConnectionThrowsExceptionInConstructor() throws PersistenceException {
    final OfficePersistence officePersistence = mock(OfficePersistence.class);
    try {
        when(officePersistence.getHeadOffice()).thenThrow(new PersistenceException("some exception"));
        new RateFeeBO(null, "Customer Fee", new CategoryTypeEntity(FeeCategory.CENTER), new FeeFrequencyTypeEntity(FeeFrequencyType.ONETIME), null, 2.0, null, false, new FeePaymentEntity(FeePayment.UPFRONT)) {

            @Override
            public OfficePersistence getOfficePersistence() {
                return officePersistence;
            }
        };
        Assert.fail("should fail because of invalid session");
    } catch (FeeException e) {
    }
}
Also used : FeeException(org.mifos.accounts.fees.exceptions.FeeException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Test(org.junit.Test) ExpectedException(org.springframework.test.annotation.ExpectedException)

Aggregations

FeeException (org.mifos.accounts.fees.exceptions.FeeException)2 PersistenceException (org.mifos.framework.exceptions.PersistenceException)2 Test (org.junit.Test)1 LegacyAccountDao (org.mifos.accounts.persistence.LegacyAccountDao)1 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)1 ExpectedException (org.springframework.test.annotation.ExpectedException)1