Search in sources :

Example 86 with Ignore

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

the class SavingsBOTest method depositScheduleIsGeneratedOnCreationWithMoratoriumOnSecondScheduledDeposit.

/**
     * passing locally on eclipse but not on maven.
     */
@Ignore
@Test
public void depositScheduleIsGeneratedOnCreationWithMoratoriumOnSecondScheduledDeposit() {
    // setup
    Holiday moratorium = new HolidayBuilder().from(new DateMidnight().toDateTime().plusWeeks(1)).to(new DateMidnight().toDateTime().plusWeeks(1)).withRepaymentMoratoriumRule().build();
    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();
    // verify
    List<SavingsScheduleEntity> sortedSavingsSchedules = getSortedSavingsScheduleEntities();
    assertThat(sortedSavingsSchedules.size(), is(10));
    DateTime installmentDate = new DateMidnight().toDateTime();
    int installmentId = 1;
    for (SavingsScheduleEntity savingsScheduleEntity : sortedSavingsSchedules) {
        if (installmentId < 2) {
            assertThat("Installment " + installmentId, new LocalDate(savingsScheduleEntity.getActionDate()), is(new LocalDate(installmentDate.toDate())));
        } else {
            // Second and later deposits are pushed out one week by the moratorium
            assertThat("Installment " + installmentId, new LocalDate(savingsScheduleEntity.getActionDate()), is(new LocalDate(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) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) SavingsScheduleEntity(org.mifos.accounts.savings.business.SavingsScheduleEntity) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 87 with Ignore

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

the class SavingsAdjustmentTest method cannotAdjustLastTransactionThatWhoosePaymentDateIsNotWithinCurrentInterestPostingPeriod.

@Test
@Ignore
public void cannotAdjustLastTransactionThatWhoosePaymentDateIsNotWithinCurrentInterestPostingPeriod() {
    Money amountAdjustedTo = TestUtils.createMoney("25");
    DateTime activationDate = new DateTime().withDate(2010, 1, 1);
    savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).withActivationDate(activationDate).withBalanceOf(TestUtils.createMoney("0")).withDepositOn("15", activationDate.minusDays(1)).build();
    // exercise test
    boolean result = savingsAccount.isAdjustPossibleOnTrxn(amountAdjustedTo, savingsAccount.getLastPmnt());
    // verification
    assertFalse(result);
}
Also used : Money(org.mifos.framework.util.helpers.Money) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 88 with Ignore

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

the class SavingsBOTest method overpayingMandatoryOrVoluntaryDepositAmountResultsInASavingsTrxnDetailForExcessAmountToBeAddedToAccountPaymentTransactions.

@Ignore
@Test
public void overpayingMandatoryOrVoluntaryDepositAmountResultsInASavingsTrxnDetailForExcessAmountToBeAddedToAccountPaymentTransactions() throws AccountException {
    // setup
    savingsAccount = savingsAccountBuilder.build();
    final SavingsScheduleEntity unpaidSaving1 = new SavingsScheduleBuilder().withAccount(savingsAccount).withCustomer(payingCustomer).build();
    final List<SavingsScheduleEntity> unpaidDepositsForPayingCustomer = Arrays.asList(unpaidSaving1);
    final Money zero = new Money(defaultCurrency);
    savingsAccount = savingsAccountBuilder.withBalanceOf(zero).completeGroup().withPayments(unpaidDepositsForPayingCustomer).buildForUnitTests();
    final Money amountToDeposit = new Money(TestUtils.RUPEE, "100.0");
    final Date dateOfDeposit = new DateTime().toDate();
    final Money excessDepositAmount = new Money(TestUtils.RUPEE, "25.0");
    final Money expectedTotalBalance = amountToDeposit.add(zero);
    // stubbing
    when(accountPayment.getAmount()).thenReturn(amountToDeposit);
    when(accountPayment.getPaymentDate()).thenReturn(dateOfDeposit);
    when(paymentStrategy.makeScheduledPayments(accountPayment, unpaidDepositsForPayingCustomer, payingCustomer, SavingsType.VOLUNTARY, zero)).thenReturn(excessDepositAmount);
    when(savingsTransactionActivityHelper.createSavingsTrxnForDeposit(accountPayment, excessDepositAmount, payingCustomer, null, expectedTotalBalance)).thenReturn(savingsTrxnDetail);
    // exercise test
    savingsAccount.deposit(accountPayment, payingCustomer);
    // verification
    verify(accountPayment).addAccountTrxn(savingsTrxnDetail);
}
Also used : SavingsScheduleBuilder(org.mifos.domain.builders.SavingsScheduleBuilder) Money(org.mifos.framework.util.helpers.Money) SavingsScheduleEntity(org.mifos.accounts.savings.business.SavingsScheduleEntity) Date(java.util.Date) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 89 with Ignore

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

the class SavingsBOTest method overpayingMandatoryOrVoluntaryDepositAmountCausesAnExcessTransactionToBeCreated.

@Ignore
@Test
public void overpayingMandatoryOrVoluntaryDepositAmountCausesAnExcessTransactionToBeCreated() throws AccountException {
    // setup
    SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().buildForUnitTests();
    savingsAccount = savingsAccountBuilder.withSavingsProduct(savingsProduct).build();
    final SavingsScheduleEntity unpaidSaving1 = new SavingsScheduleBuilder().withAccount(savingsAccount).withCustomer(payingCustomer).build();
    final List<SavingsScheduleEntity> unpaidDepositsForPayingCustomer = Arrays.asList(unpaidSaving1);
    final Money zero = new Money(defaultCurrency);
    SavingsOfferingBO manSavingsProduct = new SavingsProductBuilder().mandatory().buildForUnitTests();
    savingsAccount = savingsAccountBuilder.withSavingsProduct(manSavingsProduct).withBalanceOf(zero).withPayments(unpaidDepositsForPayingCustomer).buildForUnitTests();
    final Money amountToDeposit = new Money(TestUtils.RUPEE, "100.0");
    final Date dateOfDeposit = new DateTime().toDate();
    final Money excessDepositAmount = new Money(TestUtils.RUPEE, "25.0");
    final Money expectedTotalBalance = amountToDeposit.add(zero);
    // stubbing
    when(accountPayment.getAmount()).thenReturn(amountToDeposit);
    when(accountPayment.getPaymentDate()).thenReturn(dateOfDeposit);
    when(paymentStrategy.makeScheduledPayments(accountPayment, unpaidDepositsForPayingCustomer, payingCustomer, SavingsType.MANDATORY, zero)).thenReturn(excessDepositAmount);
    // exercise test
    savingsAccount.deposit(accountPayment, payingCustomer);
    // verification
    verify(this.savingsTransactionActivityHelper).createSavingsTrxnForDeposit(accountPayment, excessDepositAmount, payingCustomer, null, expectedTotalBalance);
}
Also used : SavingsScheduleBuilder(org.mifos.domain.builders.SavingsScheduleBuilder) Money(org.mifos.framework.util.helpers.Money) SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsScheduleEntity(org.mifos.accounts.savings.business.SavingsScheduleEntity) Date(java.util.Date) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 90 with Ignore

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

the class SavingsBOTest method savingsBalanceIsIncrementedByTotalAmountDeposited.

/**
     * FIXME - ignoring as is hitting hibernate..
     */
@Ignore
@Test
public void savingsBalanceIsIncrementedByTotalAmountDeposited() throws AccountException {
    // setup
    final Money zero = new Money(defaultCurrency);
    savingsAccount = savingsAccountBuilder.withBalanceOf(zero).asInActive().build();
    final Money amountToDeposit = new Money(TestUtils.RUPEE, "100.0");
    final Date dateOfDeposit = new DateTime().toDate();
    // stubbing
    when(accountPayment.getAmount()).thenReturn(amountToDeposit);
    when(accountPayment.getPaymentDate()).thenReturn(dateOfDeposit);
    // exercise test
    savingsAccount.deposit(accountPayment, payingCustomer);
    // verification
    assertThat(savingsAccount.getSavingsBalance(), is(amountToDeposit));
}
Also used : Money(org.mifos.framework.util.helpers.Money) Date(java.util.Date) LocalDate(org.joda.time.LocalDate) 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