public void test_weekOfMonth_buildDate_sun7() { // July 2011 starts on a Friday // Fri/Sat 1st/2nd are week 0 WeekRules wr = WeekRules.of(SUNDAY, 7); for (int i = 1; i <= 31; i++) { int w = MathUtils.floorDiv(i - 3, 7) + 1; int d = MathUtils.floorMod(i - 3, 7) + 1; CalendricalEngine engine = CalendricalEngine.merge( YearMonth.of(2011, JULY), wr.weekOfMonth().field(w), wr.dayOfWeek().field(d)); assertEquals(engine.derive(LocalDate.rule()), LocalDate.of(2011, JULY, i)); } }
public void test_getValue_Calendrical_yearMonth() { Calendrical cal = YearMonth.of(2007, 6); assertEquals(rule().getValue(cal), rule().field(2007)); }