use of org.mifos.framework.exceptions.PersistenceException 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) {
}
}
use of org.mifos.framework.exceptions.PersistenceException 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) {
}
}
use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.
the class TestObjectFactory method generateOfficeGlobalNo.
private static String generateOfficeGlobalNo() throws OfficeException {
try {
/*
* TODO: Why not auto-increment? Fetching the max and adding one would seem to have a race condition.
*/
String officeGlobelNo = String.valueOf(new OfficePersistence().getMaxOfficeId().intValue() + 1);
if (officeGlobelNo.length() > 4) {
throw new OfficeException(OfficeConstants.MAXOFFICELIMITREACHED);
}
StringBuilder temp = new StringBuilder("");
for (int i = officeGlobelNo.length(); i < 4; i++) {
temp.append("0");
}
return officeGlobelNo = temp.append(officeGlobelNo).toString();
} catch (PersistenceException e) {
throw new OfficeException(e);
}
}
use of org.mifos.framework.exceptions.PersistenceException 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) {
}
}
use of org.mifos.framework.exceptions.PersistenceException in project head by mifos.
the class GroupBusinessServiceTest method testInvalidConnectionInFindBySystemId.
@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInFindBySystemId() throws PersistenceException {
try {
String globalCustNo = "globalCustNo";
when(groupPersistence.findBySystemId(globalCustNo)).thenThrow(new PersistenceException("some exception"));
service.findBySystemId(globalCustNo);
junit.framework.Assert.fail("should fail because of invalid session");
} catch (ServiceException e) {
}
}
Aggregations