Search in sources :

Example 6 with DailyInterestScheduledEvent

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

the class DailyInterestScheduledEventTest method shouldReturnAllMatchingDailyDatesStartingFromFiscalStartDateUpToCutOffDate.

@Test
public void shouldReturnAllMatchingDailyDatesStartingFromFiscalStartDateUpToCutOffDate() {
    // setup
    int every = 1;
    dailyEvent = new DailyInterestScheduledEvent(every);
    // exercise test
    List<LocalDate> nextValidMatchingDate = dailyEvent.findAllMatchingDatesFromBaseDateUpToAndIncludingNearestMatchingEndDate(startOfFiscalYear, cutOffDate);
    assertThat(nextValidMatchingDate, hasItem(jan1st));
    assertThat(nextValidMatchingDate, hasItem(jan2nd));
    assertThat(nextValidMatchingDate, hasItem(jan3rd));
    assertThat(nextValidMatchingDate, hasItem(dec31st));
}
Also used : LocalDate(org.joda.time.LocalDate) DailyInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.DailyInterestScheduledEvent) Test(org.junit.Test)

Example 7 with DailyInterestScheduledEvent

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

the class CalendarPeriodHelperTest method shouldDetermineLowerAndUpperDateRangesForDailyScheduledEvent.

@Test
public void shouldDetermineLowerAndUpperDateRangesForDailyScheduledEvent() {
    // setup
    LocalDate firstDepositDate = new LocalDate().withYear(2010).withMonthOfYear(9).withDayOfMonth(1);
    InterestScheduledEvent every14Days = new DailyInterestScheduledEvent(14);
    // exercise test
    List<CalendarPeriod> validIntervals = this.calendarPeriodHelper.determineAllPossiblePeriods(firstDepositDate, every14Days, october5th);
    // verification
    assertFalse(validIntervals.isEmpty());
    assertThat(validIntervals.get(0).getStartDate(), is(new LocalDate().withYear(2010).withMonthOfYear(9).withDayOfMonth(1)));
    assertThat(validIntervals.get(0).getEndDate(), is(new LocalDate().withYear(2010).withMonthOfYear(9).withDayOfMonth(9)));
    assertThat(validIntervals.get(1).getStartDate(), is(new LocalDate().withYear(2010).withMonthOfYear(9).withDayOfMonth(10)));
    assertThat(validIntervals.get(1).getEndDate(), is(new LocalDate().withYear(2010).withMonthOfYear(9).withDayOfMonth(23)));
}
Also used : DailyInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.DailyInterestScheduledEvent) InterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.InterestScheduledEvent) MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) LocalDate(org.joda.time.LocalDate) DailyInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.DailyInterestScheduledEvent) Test(org.junit.Test)

Example 8 with DailyInterestScheduledEvent

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

the class DailyInterestScheduledEventTest method shouldReturnFalseForInvalidMatch.

@Test
public void shouldReturnFalseForInvalidMatch() {
    // setup
    int every = 2;
    dailyEvent = new DailyInterestScheduledEvent(every);
    // exercise test
    boolean isMatch = dailyEvent.isAMatchingDate(jan1st, jan1st);
    assertFalse(isMatch);
}
Also used : DailyInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.DailyInterestScheduledEvent) Test(org.junit.Test)

Example 9 with DailyInterestScheduledEvent

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

the class DailyInterestScheduledEventTest method shouldReturnDateTwoDaysAheadOfJan1st.

@Test
public void shouldReturnDateTwoDaysAheadOfJan1st() {
    // setup
    int every = 2;
    dailyEvent = new DailyInterestScheduledEvent(every);
    // exercise test
    LocalDate nextValidMatchingDate = dailyEvent.nextMatchingDateFromAlreadyMatchingDate(jan1st);
    assertThat(nextValidMatchingDate, is(jan3rd));
}
Also used : LocalDate(org.joda.time.LocalDate) DailyInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.DailyInterestScheduledEvent) Test(org.junit.Test)

Example 10 with DailyInterestScheduledEvent

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

the class DailyInterestScheduledEventTest method shouldReturnFirstDateOfPeriodOfMatchingTriDailyDate.

@Test
public void shouldReturnFirstDateOfPeriodOfMatchingTriDailyDate() {
    // setup
    int every = 3;
    dailyEvent = new DailyInterestScheduledEvent(every);
    // exercise test
    LocalDate nextValidMatchingDate = dailyEvent.findFirstDateOfPeriodForMatchingDate(jan3rd);
    assertThat(nextValidMatchingDate, is(jan1st));
}
Also used : LocalDate(org.joda.time.LocalDate) DailyInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.DailyInterestScheduledEvent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)13 DailyInterestScheduledEvent (org.mifos.accounts.savings.interest.schedule.internal.DailyInterestScheduledEvent)13 LocalDate (org.joda.time.LocalDate)10 InterestScheduledEvent (org.mifos.accounts.savings.interest.schedule.InterestScheduledEvent)1 MonthlyOnLastDayOfMonthInterestScheduledEvent (org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent)1