public virtual void test_ofDayOfWeek_previous_oneDay() { foreach (DayOfWeek dow in DayOfWeek.values()) { RollConvention test = RollConvention.ofDayOfWeek(dow); assertEquals(test.previous(date(2014, AUGUST, 14), P1D), date(2014, AUGUST, 13).with(TemporalAdjusters.previousOrSame(dow))); } }
public virtual void test_ofDayOfWeek_next_oneMonth() { foreach (DayOfWeek dow in DayOfWeek.values()) { RollConvention test = RollConvention.ofDayOfWeek(dow); assertEquals(test.next(date(2014, AUGUST, 14), P1W), date(2014, AUGUST, 21).with(TemporalAdjusters.nextOrSame(dow))); } }
//------------------------------------------------------------------------- public virtual void test_ofDayOfWeek() { foreach (DayOfWeek dow in DayOfWeek.values()) { RollConvention test = RollConvention.ofDayOfWeek(dow); assertEquals(test.Name, "Day" + CaseFormat.UPPER_UNDERSCORE.converterTo(CaseFormat.UPPER_CAMEL).convert(dow.ToString()).substring(0, 3)); assertEquals(test.ToString(), "Day" + CaseFormat.UPPER_UNDERSCORE.converterTo(CaseFormat.UPPER_CAMEL).convert(dow.ToString()).substring(0, 3)); assertSame(RollConvention.of(test.Name), test); assertSame(RollConvention.of("DAY" + dow.ToString().Substring(0, 3)), test); } }
public virtual void test_ofDayOfWeek_matches() { assertEquals(RollConvention.ofDayOfWeek(TUESDAY).matches(date(2014, SEPTEMBER, 1)), false); assertEquals(RollConvention.ofDayOfWeek(TUESDAY).matches(date(2014, SEPTEMBER, 2)), true); assertEquals(RollConvention.ofDayOfWeek(TUESDAY).matches(date(2014, SEPTEMBER, 3)), false); }