Search in sources :

Example 36 with ExpectedException

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

the class PersonnelBusinessServiceTest method testInvalidConnectionInGetPersonnelByUsername.

@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInGetPersonnelByUsername() throws PersistenceException {
    try {
        String shortName = "shortname";
        when(personnelPersistence.getPersonnelByUserName(shortName)).thenThrow(new PersistenceException("some exception"));
        service.getPersonnel(shortName);
        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