Search in sources :

Example 31 with ServiceException

use of org.mifos.framework.exceptions.ServiceException 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 32 with ServiceException

use of org.mifos.framework.exceptions.ServiceException 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 33 with ServiceException

use of org.mifos.framework.exceptions.ServiceException 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)

Example 34 with ServiceException

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

the class PersonnelBusinessServiceTest method testInvalidConnectionInGetActiveLoanOfficersUnderOffice.

@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInGetActiveLoanOfficersUnderOffice() throws PersistenceException {
    try {
        when(personnelPersistence.getActiveLoanOfficersUnderOffice(id)).thenThrow(new PersistenceException("some exception"));
        service.getActiveLoanOfficersUnderOffice(id);
        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 35 with ServiceException

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

the class RolesPermissionsBusinessServiceTest method testInvalidConnectionInGetRole.

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

ServiceException (org.mifos.framework.exceptions.ServiceException)93 PersistenceException (org.mifos.framework.exceptions.PersistenceException)46 MifosRuntimeException (org.mifos.core.MifosRuntimeException)39 Test (org.junit.Test)34 ExpectedException (org.springframework.test.annotation.ExpectedException)29 ArrayList (java.util.ArrayList)24 UserContext (org.mifos.security.util.UserContext)19 AccountBO (org.mifos.accounts.business.AccountBO)17 MifosUser (org.mifos.security.MifosUser)16 LoanBO (org.mifos.accounts.loan.business.LoanBO)15 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)14 AccountException (org.mifos.accounts.exceptions.AccountException)13 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)13 BusinessRuleException (org.mifos.service.BusinessRuleException)11 Date (java.util.Date)8 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)7 BigDecimal (java.math.BigDecimal)6 ProductCategoryBusinessService (org.mifos.accounts.productdefinition.business.service.ProductCategoryBusinessService)6 DateTimeService (org.mifos.framework.util.DateTimeService)6 LocalDate (org.joda.time.LocalDate)5