Search in sources :

Example 81 with Ignore

use of org.junit.Ignore in project head by mifos.

the class LoanBOTest method testLoanSummaryShouldBeUpdateOnInstallmentScheduleUpdate.

/**
     * does't work when changing applicatonConfiguration.custom.properties file.
     * Need to pull out static references to AccountingRules in used classes.
     */
@Ignore
@Test
public void testLoanSummaryShouldBeUpdateOnInstallmentScheduleUpdate() {
    Money.setDefaultCurrency(rupee);
    LoanBO loanBO = new LoanAccountBuilder().build();
    loanBO.addAccountActionDate(getLoanScheduleEntity(rupee, getDate(23, 10, 2010), "100", "10", "1", Money.zero(rupee)));
    loanBO.addAccountActionDate(getLoanScheduleEntity(rupee, getDate(23, 11, 2010), "100", "10", "2", Money.zero(rupee)));
    loanBO.addAccountActionDate(getLoanScheduleEntity(rupee, getDate(23, 12, 2010), "100", "10", "3", Money.zero(rupee)));
    List<RepaymentScheduleInstallment> installments = new ArrayList<RepaymentScheduleInstallment>();
    installments.add(getRepaymentScheduleInstallment("24-Oct-2010", 1, "123", "12"));
    installments.add(getRepaymentScheduleInstallment("24-Nov-2010", 2, "231", "23"));
    installments.add(getRepaymentScheduleInstallment("24-Dec-2010", 3, "312", "31"));
    loanBO.updateInstallmentSchedule(installments);
    Set<LoanScheduleEntity> loanScheduleEntities = loanBO.getLoanScheduleEntities();
    LoanScheduleEntity[] loanScheduleEntitiesArr = loanScheduleEntities.toArray(new LoanScheduleEntity[loanScheduleEntities.size()]);
    assertLoanScheduleEntity(loanScheduleEntitiesArr[0], "123.0", "12.0", "2010-10-24");
    assertLoanScheduleEntity(loanScheduleEntitiesArr[1], "231.0", "23.0", "2010-11-24");
    assertLoanScheduleEntity(loanScheduleEntitiesArr[2], "312.0", "31.0", "2010-12-24");
    LoanSummaryEntity loanSummary = loanBO.getLoanSummary();
    assertEquals("666.0", loanSummary.getOriginalPrincipal().toString());
    assertEquals("66.0", loanSummary.getOriginalInterest().toString());
}
Also used : RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment) LoanAccountBuilder(org.mifos.domain.builders.LoanAccountBuilder) ArrayList(java.util.ArrayList) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 82 with Ignore

use of org.junit.Ignore in project head by mifos.

the class AccountBOIntegrationTest method testGetPeriodicFeeList.

@Ignore
@Test
public void testGetPeriodicFeeList() throws PersistenceException {
    FeeBO oneTimeFee = TestObjectFactory.createOneTimeAmountFee("One Time Fee", FeeCategory.LOAN, "20", FeePayment.TIME_OF_DISBURSEMENT);
    AccountFeesEntity accountOneTimeFee = new AccountFeesEntity(groupLoan, oneTimeFee, new Double("1.0"));
    groupLoan.addAccountFees(accountOneTimeFee);
    legacyAccountDao.createOrUpdate(groupLoan);
    StaticHibernateUtil.flushSession();
    groupLoan = TestObjectFactory.getObject(LoanBO.class, groupLoan.getAccountId());
    Assert.assertEquals(1, groupLoan.getPeriodicFeeList().size());
}
Also used : LoanBO(org.mifos.accounts.loan.business.LoanBO) FeeBO(org.mifos.accounts.fees.business.FeeBO) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 83 with Ignore

use of org.junit.Ignore in project head by mifos.

the class LoanAdjustmentsIntegrationTest method testWhenALoanIsRepaidEarlyAndThenAdjustedThatTheLoanSummaryAndSchedulesDetailsAreTheSameBeforeAndAfter.

/**
     * not sure why this is failing now.
     */
@Ignore
@Test
public void testWhenALoanIsRepaidEarlyAndThenAdjustedThatTheLoanSummaryAndSchedulesDetailsAreTheSameBeforeAndAfter() throws Exception {
    // relates to mifos-1986
    new DateTimeService().setCurrentDateTimeFixed(date(2010, 10, 13));
    loan = createLoan();
    Money initialOriginalPrincipal = loan.getLoanSummary().getOriginalPrincipal();
    Money initialOriginalInterest = loan.getLoanSummary().getOriginalInterest();
    Money initialOriginalFees = loan.getLoanSummary().getOriginalFees();
    Money initialPrincipalPaid = loan.getLoanSummary().getPrincipalPaid();
    Money initialInterestPaid = loan.getLoanSummary().getInterestPaid();
    Money initialFeesPaid = loan.getLoanSummary().getFeesPaid();
    // pay 3 installments
    makePayment(loan, "333.0");
    StaticHibernateUtil.flushAndClearSession();
    loan = (LoanBO) legacyAccountDao.getAccount(loan.getAccountId());
    loan.updateDetails(TestUtils.makeUserWithLocales());
    assertThat(loan.getLoanSummary().getOriginalPrincipal(), is(initialOriginalPrincipal));
    assertThat(loan.getLoanSummary().getOriginalInterest(), is(initialOriginalInterest));
    assertThat(loan.getLoanSummary().getOriginalFees(), is(initialOriginalFees));
    assertFalse(loan.getLoanSummary().getPrincipalPaid().equals(initialPrincipalPaid));
    assertFalse(loan.getLoanSummary().getInterestPaid().equals(initialInterestPaid));
    assertFalse(loan.getLoanSummary().getFeesPaid().equals(initialFeesPaid));
    List<LoanInstallment> copySchedule = copyLoanSchedule(loan);
    makeEarlyPayment(loan);
    StaticHibernateUtil.flushAndClearSession();
    loan = (LoanBO) legacyAccountDao.getAccount(loan.getAccountId());
    loan.updateDetails(TestUtils.makeUserWithLocales());
    // The early repayment should have caused the original interest and fees to be changed to equal the amounts
    // paid.
    assertThat(loan.getLoanSummary().getOriginalPrincipal(), is(initialOriginalPrincipal));
    assertFalse(loan.getLoanSummary().getOriginalInterest().equals(initialOriginalInterest));
    assertFalse(loan.getLoanSummary().getOriginalFees().equals(initialOriginalFees));
    assertThat(loan.getLoanSummary().getPrincipalPaid(), is(loan.getLoanSummary().getOriginalPrincipal()));
    assertThat(loan.getLoanSummary().getInterestPaid(), is(loan.getLoanSummary().getOriginalInterest()));
    assertThat(loan.getLoanSummary().getFeesPaid(), is(loan.getLoanSummary().getOriginalFees()));
    assertFalse(sameSchedule(copySchedule, loan.getAccountActionDates()));
    adjustLastLoanPayment(loan);
    StaticHibernateUtil.flushAndClearSession();
    loan = (LoanBO) legacyAccountDao.getAccount(loan.getAccountId());
    loan.updateDetails(TestUtils.makeUserWithLocales());
    // The adjustment of a completed loan should have caused the original amounts to be reset
    assertThat(loan.getLoanSummary().getOriginalPrincipal(), is(initialOriginalPrincipal));
    assertThat(loan.getLoanSummary().getOriginalInterest(), is(initialOriginalInterest));
    assertThat(loan.getLoanSummary().getOriginalFees(), is(initialOriginalFees));
    assertTrue(sameSchedule(copySchedule, loan.getAccountActionDates()));
}
Also used : Money(org.mifos.framework.util.helpers.Money) DateTimeService(org.mifos.framework.util.DateTimeService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 84 with Ignore

use of org.junit.Ignore in project head by mifos.

the class FeeActionStrutsTest method testSuccessfulEditPreview.

@Ignore
@Test
public void testSuccessfulEditPreview() throws Exception {
    fee = TestObjectFactory.createOneTimeAmountFee("One Time Fee", FeeCategory.ALLCUSTOMERS, "12.34", FeePayment.UPFRONT);
    LookUpValueEntity lookUpValue = new LookUpValueEntity();
    fee.getFeeFrequency().getFeeFrequencyType().setLookUpValue(lookUpValue);
    fee.getFeeFrequency().getFeePayment().setLookUpValue(lookUpValue);
    String feeId = fee.getFeeId().toString();
    request.setAttribute("feeModel", TestObjectFactory.getAmountBasedFee(feeId, "1", "12.34"));
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "manage");
    addRequestParameter("feeId", feeId);
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "editPreview");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("amount", "200.0");
    addRequestParameter("feeStatus", FeeStatus.INACTIVE.getValue().toString());
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.editPreview_success.toString());
    FeeActionForm actionForm = (FeeActionForm) request.getSession().getAttribute("feeactionform");
    Assert.assertEquals("200.0", actionForm.getAmount());
    Assert.assertEquals(FeeStatus.INACTIVE, actionForm.getFeeStatusValue());
    Assert.assertNull(actionForm.getRate());
    Assert.assertNull(actionForm.getFeeFormula());
}
Also used : FeeActionForm(org.mifos.accounts.fees.struts.actionforms.FeeActionForm) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 85 with Ignore

use of org.junit.Ignore in project head by mifos.

the class SavingsBOTest method generateNextSetOfMeetingDatesMoratoriumOn12thInstallment.

@Ignore
@Test
public void generateNextSetOfMeetingDatesMoratoriumOn12thInstallment() throws Exception {
    // setup
    Holiday moratorium = new HolidayBuilder().from(new DateMidnight().toDateTime().plusWeeks(11)).to(new DateMidnight().toDateTime().plusWeeks(11)).withRepaymentMoratoriumRule().build();
    List<Holiday> withMoratorium = new ArrayList<Holiday>();
    withMoratorium.add(moratorium);
    when(savingsAccountCustomer.getCustomerMeeting()).thenReturn(customerMeetingEntity);
    when(customerMeetingEntity.getMeeting()).thenReturn(defaultWeeklyCustomerMeeting);
    when(savingsAccountCustomer.getCustomerLevel()).thenReturn(customerLevelEntity);
    when(customerLevelEntity.getId()).thenReturn(CustomerLevel.CLIENT.getValue());
    // exercise test
    savingsAccount = savingsAccountBuilder.with(moratorium).buildForUnitTests();
    savingsAccount.generateNextSetOfMeetingDates(allWorkingDays, withMoratorium);
    // verify
    List<SavingsScheduleEntity> sortedSavingsSchedules = getSortedSavingsScheduleEntities();
    assertThat(sortedSavingsSchedules.size(), is(20));
    DateTime installmentDate = new DateMidnight().toDateTime();
    int installmentId = 1;
    for (SavingsScheduleEntity savingsScheduleEntity : getSortedSavingsScheduleEntities()) {
        if (installmentId < 12) {
            assertThat("Installment " + installmentId, savingsScheduleEntity.getActionDate(), is(installmentDate.toDate()));
        } else {
            // Second and later deposits are pushed out one week by the moratorium
            assertThat("Installment " + installmentId, savingsScheduleEntity.getActionDate(), is(installmentDate.plusWeeks(1).toDate()));
        }
        assertThat(savingsScheduleEntity.getDeposit(), is(new Money(TestUtils.RUPEE, "13.0")));
        assertThat(savingsScheduleEntity.getDepositPaid(), is(new Money(TestUtils.RUPEE, "0.0")));
        installmentDate = installmentDate.plusWeeks(1);
        installmentId++;
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) Holiday(org.mifos.application.holiday.business.Holiday) DateMidnight(org.joda.time.DateMidnight) ArrayList(java.util.ArrayList) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) SavingsScheduleEntity(org.mifos.accounts.savings.business.SavingsScheduleEntity) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Ignore (org.junit.Ignore)5092 Test (org.junit.Test)4807 File (java.io.File)445 ArrayList (java.util.ArrayList)374 IOException (java.io.IOException)217 HashMap (java.util.HashMap)187 List (java.util.List)171 CountDownLatch (java.util.concurrent.CountDownLatch)118 Map (java.util.Map)103 LocalDate (java.time.LocalDate)94 Dataset (org.apache.jena.query.Dataset)93 InputStream (java.io.InputStream)89 Date (java.util.Date)88 Random (java.util.Random)85 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)83 Properties (java.util.Properties)78 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)78 HashSet (java.util.HashSet)71 ByteArrayOutputStream (java.io.ByteArrayOutputStream)70 ExecutorService (java.util.concurrent.ExecutorService)70