Search in sources :

Example 21 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithoutName.

@Test
public void testBuildSavingsOfferingWithoutName() throws SystemException {
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    try {
        new SavingsOfferingBO(TestUtils.makeUser(), null, "S", productCategory, prdApplicableMaster, new Date(System.currentTimeMillis()), savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), 10.0, depglCodeEntity, intglCodeEntity);
        Assert.fail();
    } catch (ProductDefinitionException e) {
        Assert.assertTrue(true);
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) Date(java.sql.Date) Test(org.junit.Test)

Example 22 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithStartDateLessThanCurrentDate.

@Test
public void testBuildSavingsOfferingWithStartDateLessThanCurrentDate() throws SystemException {
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(-2);
    try {
        new SavingsOfferingBO(TestUtils.makeUser(), "Savings Offering", "Savi", productCategory, prdApplicableMaster, startDate, savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), 10.0, depglCodeEntity, intglCodeEntity);
        Assert.fail();
    } catch (ProductDefinitionException e) {
        Assert.assertTrue(true);
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) Date(java.sql.Date) Test(org.junit.Test)

Example 23 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithDuplicatePrdOfferingName.

@Test
public void testBuildSavingsOfferingWithDuplicatePrdOfferingName() throws SystemException {
    savingsProduct = createSavingsOfferingBO("Savings Product", "SAVP");
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(0);
    try {
        new SavingsOfferingBO(TestUtils.makeUser(), "Savings Product", "Savi", productCategory, prdApplicableMaster, startDate, savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), 10.0, depglCodeEntity, intglCodeEntity);
        Assert.fail();
    } catch (ProductDefinitionException pde) {
        Assert.assertTrue(true);
        Assert.assertEquals(ProductDefinitionConstants.DUPLPRDINSTNAME, pde.getKey());
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) Date(java.sql.Date) Test(org.junit.Test)

Example 24 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testUpdateSavingsOfferingWithDuplicateName.

@Test
public void testUpdateSavingsOfferingWithDuplicateName() throws Exception {
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(0);
    Date endDate = offSetCurrentDate(7);
    savingsProduct = createSavingsOfferingBO("Savings_offering", "S");
    createSavingsOfferingBO("Savings_offering1", "S1");
    try {
        savingsProduct.update(Short.valueOf("1"), "Savings_offering1", "S", productCategory, prdApplicableMaster, startDate, endDate, "Desc", PrdStatus.SAVINGS_ACTIVE, null, savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), new Money(getCurrency(), "100"), new Money(getCurrency(), "1"), 10.0);
        Assert.fail();
    } catch (ProductDefinitionException pde) {
        Assert.assertTrue(true);
        Assert.assertEquals(ProductDefinitionConstants.DUPLPRDINSTNAME, pde.getKey());
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) Date(java.sql.Date) Test(org.junit.Test)

Example 25 with ProductDefinitionException

use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithNoRecommendedAmountForMandatoryOffering.

@Test
public void testBuildSavingsOfferingWithNoRecommendedAmountForMandatoryOffering() throws SystemException {
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(-2);
    try {
        new SavingsOfferingBO(TestUtils.makeUser(), "Savings Product1", "SAVP", productCategory, prdApplicableMaster, startDate, savingsType, intCalType, intCalcMeeting, intPostMeeting, null, 10.0, depglCodeEntity, intglCodeEntity);
        Assert.fail();
    } catch (ProductDefinitionException e) {
        Assert.assertTrue(true);
    }
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) Date(java.sql.Date) Test(org.junit.Test)

Aggregations

ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)65 Test (org.junit.Test)51 Date (java.sql.Date)50 Money (org.mifos.framework.util.helpers.Money)49 MeetingBO (org.mifos.application.meeting.business.MeetingBO)15 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)13 PersistenceException (org.mifos.framework.exceptions.PersistenceException)9 ArrayList (java.util.ArrayList)5 InterestTypesEntity (org.mifos.application.master.business.InterestTypesEntity)5 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)4 PrdApplicableMasterEntity (org.mifos.accounts.productdefinition.business.PrdApplicableMasterEntity)4 PrdStatusEntity (org.mifos.accounts.productdefinition.business.PrdStatusEntity)4 ProductCategoryBO (org.mifos.accounts.productdefinition.business.ProductCategoryBO)4 PrdOfferingPersistence (org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 GracePeriodTypeEntity (org.mifos.accounts.productdefinition.business.GracePeriodTypeEntity)3 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)2 CategoryTypeEntity (org.mifos.accounts.fees.business.CategoryTypeEntity)2 FeeBO (org.mifos.accounts.fees.business.FeeBO)2 FeeFrequencyTypeEntity (org.mifos.accounts.fees.business.FeeFrequencyTypeEntity)2