// ----------------------------------------------------------------------- // toString() // ----------------------------------------------------------------------- @Test public void test_toString() { assertEquals(Month.JANUARY.toString(), "JANUARY"); assertEquals(Month.FEBRUARY.toString(), "FEBRUARY"); assertEquals(Month.MARCH.toString(), "MARCH"); assertEquals(Month.APRIL.toString(), "APRIL"); assertEquals(Month.MAY.toString(), "MAY"); assertEquals(Month.JUNE.toString(), "JUNE"); assertEquals(Month.JULY.toString(), "JULY"); assertEquals(Month.AUGUST.toString(), "AUGUST"); assertEquals(Month.SEPTEMBER.toString(), "SEPTEMBER"); assertEquals(Month.OCTOBER.toString(), "OCTOBER"); assertEquals(Month.NOVEMBER.toString(), "NOVEMBER"); assertEquals(Month.DECEMBER.toString(), "DECEMBER"); }
// ----------------------------------------------------------------------- // maxLength() // ----------------------------------------------------------------------- @Test public void test_maxLength() { assertEquals(Month.JANUARY.maxLength(), 31); assertEquals(Month.FEBRUARY.maxLength(), 29); assertEquals(Month.MARCH.maxLength(), 31); assertEquals(Month.APRIL.maxLength(), 30); assertEquals(Month.MAY.maxLength(), 31); assertEquals(Month.JUNE.maxLength(), 30); assertEquals(Month.JULY.maxLength(), 31); assertEquals(Month.AUGUST.maxLength(), 31); assertEquals(Month.SEPTEMBER.maxLength(), 30); assertEquals(Month.OCTOBER.maxLength(), 31); assertEquals(Month.NOVEMBER.maxLength(), 30); assertEquals(Month.DECEMBER.maxLength(), 31); }
// ----------------------------------------------------------------------- // firstMonthOfQuarter() // ----------------------------------------------------------------------- @Test public void test_firstMonthOfQuarter() { assertEquals(Month.JANUARY.firstMonthOfQuarter(), Month.JANUARY); assertEquals(Month.FEBRUARY.firstMonthOfQuarter(), Month.JANUARY); assertEquals(Month.MARCH.firstMonthOfQuarter(), Month.JANUARY); assertEquals(Month.APRIL.firstMonthOfQuarter(), Month.APRIL); assertEquals(Month.MAY.firstMonthOfQuarter(), Month.APRIL); assertEquals(Month.JUNE.firstMonthOfQuarter(), Month.APRIL); assertEquals(Month.JULY.firstMonthOfQuarter(), Month.JULY); assertEquals(Month.AUGUST.firstMonthOfQuarter(), Month.JULY); assertEquals(Month.SEPTEMBER.firstMonthOfQuarter(), Month.JULY); assertEquals(Month.OCTOBER.firstMonthOfQuarter(), Month.OCTOBER); assertEquals(Month.NOVEMBER.firstMonthOfQuarter(), Month.OCTOBER); assertEquals(Month.DECEMBER.firstMonthOfQuarter(), Month.OCTOBER); }
@Test public void test_length_boolean_leapYear() { assertEquals(Month.JANUARY.length(true), 31); assertEquals(Month.FEBRUARY.length(true), 29); assertEquals(Month.MARCH.length(true), 31); assertEquals(Month.APRIL.length(true), 30); assertEquals(Month.MAY.length(true), 31); assertEquals(Month.JUNE.length(true), 30); assertEquals(Month.JULY.length(true), 31); assertEquals(Month.AUGUST.length(true), 31); assertEquals(Month.SEPTEMBER.length(true), 30); assertEquals(Month.OCTOBER.length(true), 31); assertEquals(Month.NOVEMBER.length(true), 30); assertEquals(Month.DECEMBER.length(true), 31); }
@Test public void test_firstDayOfYear_leapYear() { assertEquals(Month.JANUARY.firstDayOfYear(true), 1); assertEquals(Month.FEBRUARY.firstDayOfYear(true), 1 + 31); assertEquals(Month.MARCH.firstDayOfYear(true), 1 + 31 + 29); assertEquals(Month.APRIL.firstDayOfYear(true), 1 + 31 + 29 + 31); assertEquals(Month.MAY.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30); assertEquals(Month.JUNE.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31); assertEquals(Month.JULY.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30); assertEquals(Month.AUGUST.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31); assertEquals(Month.SEPTEMBER.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31); assertEquals( Month.OCTOBER.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30); assertEquals( Month.NOVEMBER.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31); assertEquals( Month.DECEMBER.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30); }
@Test(expectedExceptions = NullPointerException.class) public void test_getDisplayName_nullLocale() { Month.JANUARY.getDisplayName(TextStyle.FULL, null); }
@Test(expectedExceptions = NullPointerException.class) public void test_getDisplayName_nullStyle() { Month.JANUARY.getDisplayName(null, Locale.US); }
// ----------------------------------------------------------------------- // getDisplayName() // ----------------------------------------------------------------------- @Test public void test_getDisplayName() { assertEquals(Month.JANUARY.getDisplayName(TextStyle.SHORT, Locale.US), "Jan"); }