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());
}
}
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);
}
}
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) {
}
}
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) {
}
}
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);
}
Aggregations