Exemplo n.º 1
0
 // -----------------------------------------------------------------------
 // query(TemporalQuery)
 // -----------------------------------------------------------------------
 @Test
 public void test_query() {
   assertEquals(Month.JUNE.query(TemporalQueries.chronology()), IsoChronology.INSTANCE);
   assertEquals(Month.JUNE.query(TemporalQueries.localDate()), null);
   assertEquals(Month.JUNE.query(TemporalQueries.localTime()), null);
   assertEquals(Month.JUNE.query(TemporalQueries.offset()), null);
   assertEquals(Month.JUNE.query(TemporalQueries.precision()), ChronoUnit.MONTHS);
   assertEquals(Month.JUNE.query(TemporalQueries.zone()), null);
   assertEquals(Month.JUNE.query(TemporalQueries.zoneId()), null);
 }
Exemplo n.º 2
0
 // -----------------------------------------------------------------------
 // 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");
 }
Exemplo n.º 3
0
 // -----------------------------------------------------------------------
 // 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);
 }
Exemplo n.º 4
0
 // -----------------------------------------------------------------------
 // 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);
 }
Exemplo n.º 5
0
 @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);
 }
Exemplo n.º 6
0
 @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);
 }
Exemplo n.º 7
0
 @Test(expectedExceptions = NullPointerException.class)
 public void test_query_null() {
   Month.JUNE.query(null);
 }