Search in sources :

Example 1 with MonthlyOnLastDayOfMonthInterestScheduledEvent

use of org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent in project head by mifos.

the class MonthlyOnLastDayOfMonthInterestScheduledEventTest method shouldReturnDateWithLastDayOfMonthOneMonthFromJan.

@Test
public void shouldReturnDateWithLastDayOfMonthOneMonthFromJan() {
    // setup
    int every = 1;
    monthlyEvent = new MonthlyOnLastDayOfMonthInterestScheduledEvent(every);
    // exercise test
    LocalDate nextValidMatchingDate = monthlyEvent.nextMatchingDateFromAlreadyMatchingDate(jan31st);
    assertThat(nextValidMatchingDate, is(feb28th));
}
Also used : MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 2 with MonthlyOnLastDayOfMonthInterestScheduledEvent

use of org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent in project head by mifos.

the class MonthlyOnLastDayOfMonthInterestScheduledEventTest method shouldReturnFirstDateOfPeriodOfMatchingMonthlyDate.

@Test
public void shouldReturnFirstDateOfPeriodOfMatchingMonthlyDate() {
    // setup
    int every = 1;
    monthlyEvent = new MonthlyOnLastDayOfMonthInterestScheduledEvent(every);
    // exercise test
    LocalDate nextValidMatchingDate = monthlyEvent.findFirstDateOfPeriodForMatchingDate(jun30th);
    assertThat(nextValidMatchingDate, is(jun1st));
}
Also used : MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 3 with MonthlyOnLastDayOfMonthInterestScheduledEvent

use of org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent in project head by mifos.

the class MonthlyOnLastDayOfMonthInterestScheduledEventTest method shouldReturnFirstDateOfPeriodOfMatchingBiMonthlyDate.

@Test
public void shouldReturnFirstDateOfPeriodOfMatchingBiMonthlyDate() {
    // setup
    int every = 2;
    monthlyEvent = new MonthlyOnLastDayOfMonthInterestScheduledEvent(every);
    // exercise test
    LocalDate nextValidMatchingDate = monthlyEvent.findFirstDateOfPeriodForMatchingDate(feb28th);
    assertThat(nextValidMatchingDate, is(jan1st));
}
Also used : MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 4 with MonthlyOnLastDayOfMonthInterestScheduledEvent

use of org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent in project head by mifos.

the class MonthlyOnLastDayOfMonthInterestScheduledEventTest method shouldReturnTrueForAnyMatchingDate.

@Test
public void shouldReturnTrueForAnyMatchingDate() {
    // setup
    int every = 2;
    monthlyEvent = new MonthlyOnLastDayOfMonthInterestScheduledEvent(every);
    // exercise test
    boolean isMatch = monthlyEvent.isAMatchingDate(jan1st, apr30);
    assertTrue(isMatch);
}
Also used : MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) Test(org.junit.Test)

Example 5 with MonthlyOnLastDayOfMonthInterestScheduledEvent

use of org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent in project head by mifos.

the class MonthlyOnLastDayOfMonthInterestScheduledEventTest method shouldFindNearestMatchingDateAfterOrOnALegalEndOfMonthDate.

@Test
public void shouldFindNearestMatchingDateAfterOrOnALegalEndOfMonthDate() {
    // setup
    int every = 1;
    monthlyEvent = new MonthlyOnLastDayOfMonthInterestScheduledEvent(every);
    // exercise test
    LocalDate nextMatchingDate = monthlyEvent.nextMatchingDateAfter(jan1st, jan31st);
    assertThat(nextMatchingDate, is(jan31st));
}
Also used : MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)24 MonthlyOnLastDayOfMonthInterestScheduledEvent (org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent)24 LocalDate (org.joda.time.LocalDate)18 InterestScheduledEvent (org.mifos.accounts.savings.interest.schedule.InterestScheduledEvent)12 DateTime (org.joda.time.DateTime)8 InterestCalculationPeriodResult (org.mifos.accounts.savings.interest.InterestCalculationPeriodResult)8 InterestCalculationPeriodResultBuilder (org.mifos.accounts.savings.interest.InterestCalculationPeriodResultBuilder)8 InterestPostingPeriodResult (org.mifos.accounts.savings.interest.InterestPostingPeriodResult)8 InterestPostingPeriodResultBuilder (org.mifos.accounts.savings.interest.InterestPostingPeriodResultBuilder)8 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)8 PersonnelBuilder (org.mifos.domain.builders.PersonnelBuilder)8 SavingsAccountBuilder (org.mifos.domain.builders.SavingsAccountBuilder)8 DailyInterestScheduledEvent (org.mifos.accounts.savings.interest.schedule.internal.DailyInterestScheduledEvent)4 ArrayList (java.util.ArrayList)3 AccountBO (org.mifos.accounts.business.AccountBO)3 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)2 SavingsActivityEntity (org.mifos.accounts.savings.business.SavingsActivityEntity)2 Money (org.mifos.framework.util.helpers.Money)2 AccountTrxnEntity (org.mifos.accounts.business.AccountTrxnEntity)1 SavingsTrxnDetailEntity (org.mifos.accounts.savings.business.SavingsTrxnDetailEntity)1