Search in sources :

Example 16 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method now.

//-----------------------------------------------------------------------
// now()
//-----------------------------------------------------------------------
@Test
public void now() {
    MonthDay expected = MonthDay.now(Clock.systemDefaultZone());
    MonthDay test = MonthDay.now();
    for (int i = 0; i < 100; i++) {
        if (expected.equals(test)) {
            return;
        }
        expected = MonthDay.now(Clock.systemDefaultZone());
        test = MonthDay.now();
    }
    assertEquals(test, expected);
}
Also used : MonthDay(java.time.MonthDay) Test(org.testng.annotations.Test)

Example 17 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method now_ZoneId.

@Test
public void now_ZoneId() {
    ZoneId zone = ZoneId.of("UTC+01:02:03");
    MonthDay expected = MonthDay.now(Clock.system(zone));
    MonthDay test = MonthDay.now(zone);
    for (int i = 0; i < 100; i++) {
        if (expected.equals(test)) {
            return;
        }
        expected = MonthDay.now(Clock.system(zone));
        test = MonthDay.now(zone);
    }
    assertEquals(test, expected);
}
Also used : ZoneId(java.time.ZoneId) MonthDay(java.time.MonthDay) Test(org.testng.annotations.Test)

Example 18 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method test_toString.

@Test(dataProvider = "sampleToString")
public void test_toString(int m, int d, String expected) {
    MonthDay test = MonthDay.of(m, d);
    String str = test.toString();
    assertEquals(str, expected);
}
Also used : MonthDay(java.time.MonthDay) Test(org.testng.annotations.Test)

Example 19 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method test_adjustDate.

//-----------------------------------------------------------------------
// adjustInto()
//-----------------------------------------------------------------------
@Test
public void test_adjustDate() {
    MonthDay test = MonthDay.of(6, 30);
    LocalDate date = LocalDate.of(2007, 1, 1);
    assertEquals(test.adjustInto(date), LocalDate.of(2007, 6, 30));
}
Also used : MonthDay(java.time.MonthDay) LocalDate(java.time.LocalDate) Test(org.testng.annotations.Test)

Example 20 with MonthDay

use of java.time.MonthDay in project jdk8u_jdk by JetBrains.

the class TCKMonthDay method test_withMonth_int_noChangeEqual.

@Test
public void test_withMonth_int_noChangeEqual() {
    MonthDay test = MonthDay.of(6, 30);
    assertEquals(test.withMonth(6), test);
}
Also used : MonthDay(java.time.MonthDay) Test(org.testng.annotations.Test)

Aggregations

MonthDay (java.time.MonthDay)28 Test (org.testng.annotations.Test)25 LocalDate (java.time.LocalDate)4 IOException (java.io.IOException)1 Clock (java.time.Clock)1 Instant (java.time.Instant)1 YearMonth (java.time.YearMonth)1 ZoneId (java.time.ZoneId)1 DateTimeFormatter (java.time.format.DateTimeFormatter)1 Test (org.junit.Test)1