Search in sources :

Example 6 with ExpectedException

use of org.springframework.test.annotation.ExpectedException 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 7 with ExpectedException

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

the class CenterBOTest method testInvalidConnectionInConstructor.

@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInConstructor() throws PersistenceException {
    try {
        Short id = new Short("1");
        OfficeBO office = mock(OfficeBO.class);
        when(office.getOfficeId()).thenReturn(id);
        when(customerPersistence.getCustomerCountForOffice(CustomerLevel.CENTER, id)).thenThrow(new PersistenceException("some exception"));
        new CenterBO(mock(UserContext.class), "name", null, null, null, "externalId", null, office, mock(MeetingBO.class), mock(PersonnelBO.class), customerPersistence);
        junit.framework.Assert.fail("should fail because of invalid session");
    } catch (CustomerException e) {
    }
}
Also used : CustomerException(org.mifos.customers.exceptions.CustomerException) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) UserContext(org.mifos.security.util.UserContext) MeetingBO(org.mifos.application.meeting.business.MeetingBO) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Test(org.junit.Test) ExpectedException(org.springframework.test.annotation.ExpectedException)

Example 8 with ExpectedException

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

the class CheckListBusinessServiceTest method testInvalidConnectionRetrieveAllAccountCheckLists.

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

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

the class CheckListBusinessServiceTest method testInvalidConnectionRetrieveAllCustomerCheckLists.

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

use of org.springframework.test.annotation.ExpectedException 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)

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