public virtual void test_ofCalendarDays1_adjust() { DaysAdjustment test = DaysAdjustment.ofCalendarDays(2); LocalDate @base = date(2014, 8, 15); // Fri assertEquals(test.adjust(@base, REF_DATA), date(2014, 8, 17)); // Sun assertEquals(test.resolve(REF_DATA).adjust(@base), date(2014, 8, 17)); // Sun }
public virtual void test_ofBusinessDays2_adjust() { DaysAdjustment test = DaysAdjustment.ofBusinessDays(2, SAT_SUN); LocalDate @base = date(2014, 8, 15); // Fri assertEquals(test.adjust(@base, REF_DATA), date(2014, 8, 19)); // Tue assertEquals(test.resolve(REF_DATA).adjust(@base), date(2014, 8, 19)); // Tue }
public virtual void test_ofCalendarDays2_adjust() { DaysAdjustment test = DaysAdjustment.ofCalendarDays(2, BDA_FOLLOW_SAT_SUN); LocalDate @base = date(2014, 8, 15); // Fri assertEquals(test.adjust(@base, REF_DATA), date(2014, 8, 18)); // Mon assertEquals(test.resolve(REF_DATA).adjust(@base), date(2014, 8, 18)); // Mon }
public virtual void test_ofBusinessDays3_adjust() { ImmutableHolidayCalendar cal = ImmutableHolidayCalendar.of(WED_THU, ImmutableList.of(), WEDNESDAY, THURSDAY); ReferenceData refData = ImmutableReferenceData.of(ImmutableMap.of(WED_THU, cal)).combinedWith(REF_DATA); DaysAdjustment test = DaysAdjustment.ofBusinessDays(3, SAT_SUN, BDA_FOLLOW_WED_THU); LocalDate @base = date(2014, 8, 15); // Fri assertEquals(test.adjust(@base, refData), date(2014, 8, 22)); // Fri (3 days gives Wed, following moves to Fri) assertEquals(test.resolve(refData).adjust(@base), date(2014, 8, 22)); // Fri (3 days gives Wed, following moves to Fri) }