use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.
the class LoanOfferingBOIntegrationTest method testUpdateloanOfferingWithEndDateLessThanStartDate.
@Test
public void testUpdateloanOfferingWithEndDateLessThanStartDate() throws SystemException, ApplicationException {
createIntitalObjects();
Date startDate = offSetCurrentDate(0);
Date endDate = offSetCurrentDate(-2);
product = createLoanOfferingBO("Loan Product", "LOAP");
try {
product.update((short) 1, "Loan Product", "LOAN", productCategory, prdApplicableMaster, startDate, endDate, "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) {
}
}
use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.
the class LoanOfferingBOIntegrationTest method testDefInstallmentsNotBetweenMinMaxInstallments.
@Test
public void testDefInstallmentsNotBetweenMinMaxInstallments() {
createIntitalObjects();
Date startDate = offSetCurrentDate(0);
Date endDate = offSetCurrentDate(2);
try {
new LoanOfferingBO(TestObjectFactory.getContext(), "Loan Offering", "LOAP", productCategory, prdApplicableMaster, startDate, endDate, null, null, null, interestTypes, new Money(getCurrency(), "1000"), new Money(getCurrency(), "3000"), new Money(getCurrency(), "2000.0"), 12.0, 2.0, 3.0, (short) 20, (short) 11, (short) 7, false, false, false, null, null, null, frequency, principalglCodeEntity, intglCodeEntity, waiverInterest);
Assert.fail();
} catch (ProductDefinitionException e) {
}
}
use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.
the class LoanOfferingBOIntegrationTest method testDefAmountNotBetweenMinMaxAmounts.
@Test
public void testDefAmountNotBetweenMinMaxAmounts() {
PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
createIntitalObjects();
Date startDate = offSetCurrentDate(0);
Date endDate = offSetCurrentDate(2);
try {
new LoanOfferingBO(TestObjectFactory.getContext(), "Loan Offering", "LOAP", productCategory, prdApplicableMaster, startDate, endDate, null, null, null, interestTypes, new Money(getCurrency(), "1000"), new Money(getCurrency(), "3000"), new Money(getCurrency(), "200.0"), 12.0, 2.0, 3.0, (short) 20, (short) 1, (short) 12, false, false, false, null, null, null, frequency, principalglCodeEntity, intglCodeEntity, waiverInterest);
Assert.fail();
} catch (ProductDefinitionException e) {
}
}
use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.
the class TestObjectFactory method createLoanOfferingFromLastLoan.
public static LoanOfferingBO createLoanOfferingFromLastLoan(final String name, final String shortName, final ApplicableTo applicableTo, final Date startDate, final PrdStatus offeringStatus, final Double defIntRate, final InterestType interestType, final boolean interestDeductedAtDisbursement, final boolean principalDueInLastInstallment, final MeetingBO meeting, final GraceType graceType, final LoanPrdActionForm loanPrdActionForm) {
PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(applicableTo);
ProductCategoryBO productCategory = TestObjectFactory.getLoanPrdCategory();
GracePeriodTypeEntity gracePeriodType = new GracePeriodTypeEntity(graceType);
InterestTypesEntity interestTypes = new InterestTypesEntity(interestType);
GLCodeEntity glCodePrincipal = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, Short.valueOf("11"));
GLCodeEntity glCodeInterest = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, Short.valueOf("21"));
short gracePeriodDuration = (short) 2;
LoanOfferingBO loanOffering;
boolean loanCounter = true;
boolean waiverInterest = true;
try {
loanOffering = new LoanOfferingBO(getContext(), name, shortName, productCategory, prdApplicableMaster, startDate, null, null, gracePeriodType, gracePeriodDuration, interestTypes, defIntRate, defIntRate, defIntRate, loanCounter, interestDeductedAtDisbursement, principalDueInLastInstallment, new ArrayList<FundBO>(), new ArrayList<FeeBO>(), new ArrayList<PenaltyBO>(), meeting, glCodePrincipal, glCodeInterest, loanPrdActionForm, waiverInterest);
} catch (ProductDefinitionException e) {
throw new RuntimeException(e);
}
PrdStatusEntity prdStatus = testObjectPersistence.retrievePrdStatus(offeringStatus);
LoanOfferingTestUtils.setStatus(loanOffering, prdStatus);
LoanOfferingTestUtils.setGracePeriodType(loanOffering, gracePeriodType, gracePeriodDuration);
return (LoanOfferingBO) testObjectPersistence.persist(loanOffering);
}
use of org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException in project head by mifos.
the class TestObjectFactory method createSavingsProduct.
public static SavingsOfferingBO createSavingsProduct(final String name, final String shortName, final ApplicableTo applicableTo, final Date startDate, final PrdStatus status, final Double recommendedAmount, final RecommendedAmountUnit recommendedAmountUnit, final Double intRate, final Double maxAmtWithdrawl, final Double minAmtForInt, final SavingsType savingsType, final InterestCalcType interestCalculationType, final MeetingBO intCalcMeeting, final MeetingBO intPostMeeting, final Short depGLCode, final Short withGLCode) {
GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, depGLCode);
GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, withGLCode);
ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, SAMPLE_CATEGORY);
PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(applicableTo);
SavingsTypeEntity savingsTypeEntity = new SavingsTypeEntity(savingsType);
InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(interestCalculationType);
RecommendedAmntUnitEntity amountUnit = new RecommendedAmntUnitEntity(recommendedAmountUnit);
SavingsOfferingBO product;
try {
product = new SavingsOfferingBO(TestUtils.makeUserWithLocales(), name, shortName, productCategory, prdApplicableMaster, startDate, null, null, amountUnit, savingsTypeEntity, intCalType, intCalcMeeting, intPostMeeting, TestUtils.createMoney(recommendedAmount), TestUtils.createMoney(maxAmtWithdrawl), TestUtils.createMoney(minAmtForInt), intRate, depglCodeEntity, intglCodeEntity);
} catch (ProductDefinitionException e) {
throw new RuntimeException(e);
} catch (SystemException e) {
throw new RuntimeException(e);
}
PrdStatusEntity prdStatus = testObjectPersistence.retrievePrdStatus(status);
product.setPrdStatus(prdStatus);
return (SavingsOfferingBO) testObjectPersistence.persist(product);
}
Aggregations