Search in sources :

Example 61 with PersistenceException

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

the class GroupBusinessServiceTest method testInvalidConnectionInGetGroup.

@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInGetGroup() throws PersistenceException {
    try {
        Integer customerId = new Integer(1);
        when(groupPersistence.getGroupByCustomerId(customerId)).thenThrow(new PersistenceException("some exception"));
        service.getGroup(customerId);
        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 62 with PersistenceException

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

the class GroupBusinessServiceTest method testInvalidConnectionInFindBySystemId.

@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInFindBySystemId() throws PersistenceException {
    try {
        String globalCustNo = "globalCustNo";
        when(groupPersistence.findBySystemId(globalCustNo)).thenThrow(new PersistenceException("some exception"));
        service.findBySystemId(globalCustNo);
        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 63 with PersistenceException

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

the class GroupBusinessServiceTest method testInvalidConnectionInSearch.

@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInSearch() throws PersistenceException {
    try {
        String searchWord = "globalCustNo";
        Short userId = new Short("1");
        when(groupPersistence.search(searchWord, userId)).thenThrow(new PersistenceException("some exception"));
        service.search(searchWord, userId);
        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 64 with PersistenceException

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

the class OfficeBusinessServiceTest method testInvalidConnectionInGetBranchOffices.

@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInGetBranchOffices() throws PersistenceException {
    try {
        when(officePersistence.getBranchOffices()).thenThrow(new PersistenceException("some exception"));
        service.getBranchOffices();
        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 65 with PersistenceException

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

the class OfficeBusinessServiceTest method testInvalidConnectionInGetOfficesTillBranchOffice.

@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInGetOfficesTillBranchOffice() throws PersistenceException {
    try {
        when(officePersistence.getOfficesTillBranchOffice()).thenThrow(new PersistenceException("some exception"));
        service.getOfficesTillBranchOffice();
        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)

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