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));
}
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)));
}
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);
}
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));
}
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));
}
Aggregations