Search in sources :

Example 1 with DailyInterestScheduledEvent

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

the class DailyInterestScheduledEventTest method shouldReturnFirstDateOfPeriodOfMatchingBiDailyDate.

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

Example 2 with DailyInterestScheduledEvent

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

the class DailyInterestScheduledEventTest method shouldFindNearestMatchingDateAfterALegalDailyDate.

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

Example 3 with DailyInterestScheduledEvent

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

the class DailyInterestScheduledEventTest method shouldReturnDateOneDayAheadOfJan1st.

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

Example 4 with DailyInterestScheduledEvent

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

the class DailyInterestScheduledEventTest method shouldReturnAllMatchingBiDailyDatesStartingFromFiscalStartDateUpToCutOffDate.

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

Example 5 with DailyInterestScheduledEvent

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

the class DailyInterestScheduledEventTest method shouldReturnTrueForMatchingDate.

@Test
public void shouldReturnTrueForMatchingDate() {
    // setup
    int every = 1;
    dailyEvent = new DailyInterestScheduledEvent(every);
    // exercise test
    boolean isMatch = dailyEvent.isAMatchingDate(jan1st, jan2nd);
    assertTrue(isMatch);
}
Also used : 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