use of org.springframework.test.annotation.ExpectedException in project head by mifos.
the class FeeBOTest method testInvalidConnectionThrowsExceptionInConstructor.
@Test
@ExpectedException(value = FeeException.class)
public void testInvalidConnectionThrowsExceptionInConstructor() throws PersistenceException {
final OfficePersistence officePersistence = mock(OfficePersistence.class);
try {
when(officePersistence.getHeadOffice()).thenThrow(new PersistenceException("some exception"));
new RateFeeBO(null, "Customer Fee", new CategoryTypeEntity(FeeCategory.CENTER), new FeeFrequencyTypeEntity(FeeFrequencyType.ONETIME), null, 2.0, null, false, new FeePaymentEntity(FeePayment.UPFRONT)) {
@Override
public OfficePersistence getOfficePersistence() {
return officePersistence;
}
};
Assert.fail("should fail because of invalid session");
} catch (FeeException e) {
}
}
use of org.springframework.test.annotation.ExpectedException 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) {
}
}
use of org.springframework.test.annotation.ExpectedException 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) {
}
}
use of org.springframework.test.annotation.ExpectedException 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) {
}
}
use of org.springframework.test.annotation.ExpectedException 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) {
}
}
Aggregations