// ----------------------------------------------------------------------- // weekOfMonth() // ----------------------------------------------------------------------- public void test_weekOfMonth_sun1() { DateTimeRule rule = WeekRules.of(SUNDAY, 1).weekOfMonth(); assertEquals(rule.toString(), "WeekOfMonth-WeekRules[SUNDAY,1]"); assertEquals(rule.getBaseRule(), rule); assertEquals(rule.convertToPeriod(-1), -1); assertEquals(rule.convertToPeriod(0), 0); assertEquals(rule.convertToPeriod(1), 1); assertEquals(rule.convertToPeriod(2), 2); assertEquals(rule.convertToPeriod(5), 5); assertEquals(rule.convertToPeriod(6), 6); assertEquals(rule.convertFromPeriod(-1), -1); assertEquals(rule.convertFromPeriod(0), 0); assertEquals(rule.convertFromPeriod(1), 1); assertEquals(rule.convertFromPeriod(2), 2); assertEquals(rule.convertFromPeriod(5), 5); assertEquals(rule.convertFromPeriod(6), 6); }
// ----------------------------------------------------------------------- // dayOfWeek() // ----------------------------------------------------------------------- public void test_dayOfWeek_sun1() { DateTimeRule rule = WeekRules.of(SUNDAY, 1).dayOfWeek(); assertEquals(rule.toString(), "DayOfWeek-WeekRules[SUNDAY,1]"); assertEquals(rule.getBaseRule(), rule); assertEquals(rule.convertToPeriod(1), 0); // Sun assertEquals(rule.convertToPeriod(2), 1); // Mon assertEquals(rule.convertToPeriod(3), 2); // Tue assertEquals(rule.convertToPeriod(4), 3); // Wed assertEquals(rule.convertToPeriod(5), 4); // Thu assertEquals(rule.convertToPeriod(6), 5); // Fri assertEquals(rule.convertToPeriod(7), 6); // Sat assertEquals(rule.convertToPeriod(8), 7); assertEquals(rule.convertToPeriod(0), -1); assertEquals(rule.convertFromPeriod(0), 1); // Sun assertEquals(rule.convertFromPeriod(6), 7); // Sat assertEquals(rule.convertFromPeriod(-1), 0); assertEquals(rule.convertFromPeriod(7), 8); }