Search in sources :

Example 51 with ProductDefinitionException

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

the class SavingsOfferingBOIntegrationTest method testUpdateFailureWithInitialStartDateInFuture.

@Test
public void testUpdateFailureWithInitialStartDateInFuture() throws Exception {
    String name = "Savings_offering";
    String newName = "Savings_offeringChanged";
    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(5);
    Date endDate = offSetCurrentDate(15);
    savingsProduct = createSavingsOfferingBO(name, "S", ApplicableTo.CLIENTS, startDate, PrdStatus.SAVINGS_INACTIVE, SavingsType.VOLUNTARY, InterestCalcType.AVERAGE_BALANCE);
    Date newStartDate = reduceCurrentDate(1);
    try {
        savingsProduct.update(Short.valueOf("1"), newName, "S1", productCategory, prdApplicableMaster, newStartDate, endDate, "Desc", PrdStatus.SAVINGS_INACTIVE, 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.INVALIDSTARTDATE, 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 52 with ProductDefinitionException

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

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithoutGLCode.

@Test
public void testBuildSavingsOfferingWithoutGLCode() throws SystemException {
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    try {
        new SavingsOfferingBO(TestUtils.makeUser(), "Savings offering", "S", productCategory, prdApplicableMaster, new Date(System.currentTimeMillis()), savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), 10.0, null, null);
        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) Date(java.sql.Date) Test(org.junit.Test)

Example 53 with ProductDefinitionException

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

the class LoanOfferingBOIntegrationTest method testBuildloanOfferingWithDuplicatePrdOfferingShortName.

@Test
public void testBuildloanOfferingWithDuplicatePrdOfferingShortName() throws SystemException, ApplicationException {
    product = createLoanOfferingBO("Loan Product", "LOAP");
    createIntitalObjects();
    Date startDate = offSetCurrentDate(0);
    try {
        new LoanOfferingBO(TestObjectFactory.getContext(), "Loan Offering", "LOAP", productCategory, prdApplicableMaster, startDate, interestTypes, new Money(getCurrency(), "1000"), new Money(getCurrency(), "3000"), 12.0, 2.0, 3.0, (short) 20, (short) 1, (short) 12, false, false, false, frequency, principalglCodeEntity, intglCodeEntity, waiverInterest);
        Assert.fail();
    } catch (ProductDefinitionException e) {
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) Date(java.sql.Date) Test(org.junit.Test)

Example 54 with ProductDefinitionException

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

the class LoanOfferingBOIntegrationTest method testUpdateloanOfferingWithShortNameGreaterThanFourDig.

@Test
public void testUpdateloanOfferingWithShortNameGreaterThanFourDig() throws SystemException, ApplicationException {
    createIntitalObjects();
    product = createLoanOfferingBO("Loan Product", "LOAP");
    try {
        product.update((short) 1, "Loan Product", "LOANS", productCategory, prdApplicableMaster, new Date(System.currentTimeMillis()), null, "Loan Product updated", PrdStatus.LOAN_ACTIVE, null, interestTypes, (short) 0, new Money(getCurrency(), "3000"), new Money(getCurrency(), "1000"), new Money(getCurrency(), "2000"), 12.0, 2.0, 3.0, (short) 20, (short) 1, (short) 12, false, false, false, null, null, null, (short) 2, RecurrenceType.WEEKLY, waiverInterest);
        Assert.fail();
    } catch (ProductDefinitionException e) {
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) Date(java.sql.Date) Test(org.junit.Test)

Example 55 with ProductDefinitionException

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

the class LoanOfferingBOIntegrationTest method testUpdateloanOfferingWithDuplicatePrdOfferingName.

@Test
public void testUpdateloanOfferingWithDuplicatePrdOfferingName() throws SystemException, ApplicationException {
    product = createLoanOfferingBO("Loan Product", "LOAP");
    LoanOfferingBO loanOffering1 = createLoanOfferingBO("Loan Product1", "LOA1");
    createIntitalObjects();
    Date startDate = offSetCurrentDate(0);
    try {
        loanOffering1.update((short) 1, "Loan Product", "LOAN", productCategory, prdApplicableMaster, startDate, null, "Loan Product updated", PrdStatus.LOAN_ACTIVE, null, interestTypes, (short) 0, new Money(getCurrency(), "3000"), new Money(getCurrency(), "1000"), new Money(getCurrency(), "2000"), 12.0, 2.0, 3.0, (short) 20, (short) 1, (short) 12, false, false, false, null, null, null, (short) 2, RecurrenceType.WEEKLY, waiverInterest);
        Assert.fail();
    } catch (ProductDefinitionException e) {
    }
    TestObjectFactory.removeObject(loanOffering1);
}
Also used : Money(org.mifos.framework.util.helpers.Money) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) 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