Search in sources :

Example 21 with ServiceException

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

the class LoanPrdBusinessServiceTest method testInvalidConnectionThrowsExceptionInGetApplicableProductCategories.

@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionThrowsExceptionInGetApplicableProductCategories() throws PersistenceException {
    try {
        when(prdOfferingPersistence.getApplicableProductCategories(ProductType.LOAN, PrdCategoryStatus.ACTIVE)).thenThrow(new PersistenceException("some exception"));
        loanPrdBusinessService.getActiveLoanProductCategories();
        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 22 with ServiceException

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

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

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

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

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