Search in sources :

Example 26 with ExpectedException

use of org.springframework.test.annotation.ExpectedException in project head by mifos.

the class LoanPrdBusinessServiceTest method testInvalidConnectionThrowsExceptionInGetLoanOfferingWithLocaleId.

@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionThrowsExceptionInGetLoanOfferingWithLocaleId() throws PersistenceException {
    try {
        when(loanPrdPersistence.getLoanOffering(new Short("112"), localeId)).thenThrow(new PersistenceException("some exception"));
        loanPrdBusinessService.getLoanOffering(new Short("112"), localeId);
        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 27 with ExpectedException

use of org.springframework.test.annotation.ExpectedException in project head by mifos.

the class LoanPrdBusinessServiceTest method testInvalidConnectionThrowsExceptionInGetApplicablePrdStatus.

@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionThrowsExceptionInGetApplicablePrdStatus() throws PersistenceException {
    try {
        when(prdOfferingPersistence.getApplicablePrdStatus(ProductType.LOAN, localeId)).thenThrow(new PersistenceException("some exception"));
        loanPrdBusinessService.getApplicablePrdStatus(localeId);
        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 28 with ExpectedException

use of org.springframework.test.annotation.ExpectedException in project head by mifos.

the class ProductCategoryBusinessServiceTest method testInvalidConnectionGetProductTypes.

@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionGetProductTypes() throws PersistenceException {
    try {
        when(productCategoryPersistence.getProductTypes()).thenThrow(new PersistenceException("some exception"));
        service.getProductTypes();
        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 29 with ExpectedException

use of org.springframework.test.annotation.ExpectedException in project head by mifos.

the class SavingsPrdBusinessServiceTest method testInvalidConnectionForGetActiveSavingsProductCategories.

@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionForGetActiveSavingsProductCategories() throws PersistenceException {
    try {
        when(prdOfferingPersistence.getApplicableProductCategories(ProductType.SAVINGS, PrdCategoryStatus.ACTIVE)).thenThrow(new PersistenceException("some exception"));
        service.getActiveSavingsProductCategories();
        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 30 with ExpectedException

use of org.springframework.test.annotation.ExpectedException in project head by mifos.

the class OfficeBusinessServiceTest method testInvalidConnectionInGetOffice.

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

Test (org.junit.Test)36 ExpectedException (org.springframework.test.annotation.ExpectedException)36 PersistenceException (org.mifos.framework.exceptions.PersistenceException)32 ServiceException (org.mifos.framework.exceptions.ServiceException)29 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)4 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)2 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)2 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)2 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)2 AccountException (org.mifos.accounts.exceptions.AccountException)1 FeeException (org.mifos.accounts.fees.exceptions.FeeException)1 LegacyAccountDao (org.mifos.accounts.persistence.LegacyAccountDao)1 MeetingBO (org.mifos.application.meeting.business.MeetingBO)1 CustomerException (org.mifos.customers.exceptions.CustomerException)1 OfficeBO (org.mifos.customers.office.business.OfficeBO)1 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)1 UserContext (org.mifos.security.util.UserContext)1