Search in sources :

Example 51 with PersistenceException

use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.

the class ProductCategoryBusinessServiceTest method testInvalidConnectionGetProductCategoryStatusList.

@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionGetProductCategoryStatusList() throws PersistenceException {
    try {
        when(productCategoryPersistence.getProductCategoryStatusList()).thenThrow(new PersistenceException("some exception"));
        service.getProductCategoryStatusList();
        junit.framework.Assert.fail("should fail because of invalid session");
    } catch (ServiceException e) {
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Test(org.junit.Test) ExpectedException(org.springframework.test.annotation.ExpectedException)

Example 52 with PersistenceException

use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.

the class ProductCategoryBusinessServiceTest method testInvalidConnectionGetAllCategories.

@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionGetAllCategories() throws PersistenceException {
    try {
        when(productCategoryPersistence.getAllCategories()).thenThrow(new PersistenceException("some exception"));
        service.getAllCategories();
        junit.framework.Assert.fail("should fail because of invalid session");
    } catch (ServiceException e) {
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Test(org.junit.Test) ExpectedException(org.springframework.test.annotation.ExpectedException)

Example 53 with PersistenceException

use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.

the class ProductCategoryBusinessServiceTest method testInvalidConnectionForFindByGlobalNum.

@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionForFindByGlobalNum() throws PersistenceException {
    String globalNum = "globalNum";
    try {
        when(productCategoryPersistence.findByGlobalNum(globalNum)).thenThrow(new PersistenceException("some exception"));
        service.findByGlobalNum(globalNum);
        junit.framework.Assert.fail("should fail because of invalid session");
    } catch (ServiceException e) {
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Test(org.junit.Test) ExpectedException(org.springframework.test.annotation.ExpectedException)

Example 54 with PersistenceException

use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.

the class SavingsPrdBusinessServiceTest method testInvalidConnectionForGetApplicablePrdStatus.

@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionForGetApplicablePrdStatus() throws PersistenceException {
    try {
        Short localeId = new Short("123");
        when(prdOfferingPersistence.getApplicablePrdStatus(ProductType.SAVINGS, localeId)).thenThrow(new PersistenceException("some exception"));
        service.getApplicablePrdStatus(localeId);
        junit.framework.Assert.fail("should fail because of invalid session");
    } catch (ServiceException e) {
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Test(org.junit.Test) ExpectedException(org.springframework.test.annotation.ExpectedException)

Example 55 with PersistenceException

use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.

the class CustomerBusinessServiceTest method testInvalidConnectionFindBySystemId.

@Test
public void testInvalidConnectionFindBySystemId() throws PersistenceException {
    try {
        String globalNum = "globalNum";
        when(customerPersistence.findBySystemId(globalNum)).thenThrow(new PersistenceException("some exception"));
        service.findBySystemId(globalNum);
        junit.framework.Assert.fail("should fail because of invalid session");
    } catch (ServiceException e) {
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Test(org.junit.Test)

Aggregations

PersistenceException (org.mifos.framework.exceptions.PersistenceException)215 MifosRuntimeException (org.mifos.core.MifosRuntimeException)98 ArrayList (java.util.ArrayList)55 ServiceException (org.mifos.framework.exceptions.ServiceException)53 AccountException (org.mifos.accounts.exceptions.AccountException)40 Test (org.junit.Test)35 ExpectedException (org.springframework.test.annotation.ExpectedException)32 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)24 BusinessRuleException (org.mifos.service.BusinessRuleException)23 Money (org.mifos.framework.util.helpers.Money)22 HibernateSearchException (org.mifos.framework.exceptions.HibernateSearchException)20 MifosUser (org.mifos.security.MifosUser)19 UserContext (org.mifos.security.util.UserContext)19 HashMap (java.util.HashMap)18 HibernateException (org.hibernate.HibernateException)18 Query (org.hibernate.Query)18 LoanBO (org.mifos.accounts.loan.business.LoanBO)18 Session (org.hibernate.Session)14 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)14 QueryResult (org.mifos.framework.hibernate.helper.QueryResult)14