Search in sources :

Example 31 with MonthDay

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

the class TestMonthDay method test_withDayOfMonth_noChangeSame.

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

Example 32 with MonthDay

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

the class TCKMonthDay method now_Clock.

//-----------------------------------------------------------------------
// now(Clock)
//-----------------------------------------------------------------------
@Test
public void now_Clock() {
    Instant instant = LocalDateTime.of(2010, 12, 31, 0, 0).toInstant(ZoneOffset.UTC);
    Clock clock = Clock.fixed(instant, ZoneOffset.UTC);
    MonthDay test = MonthDay.now(clock);
    assertEquals(test.getMonth(), Month.DECEMBER);
    assertEquals(test.getDayOfMonth(), 31);
}
Also used : Instant(java.time.Instant) MonthDay(java.time.MonthDay) Clock(java.time.Clock) Test(org.testng.annotations.Test)

Example 33 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 34 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 35 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)

Aggregations

MonthDay (java.time.MonthDay)59 Test (org.junit.Test)27 Test (org.testng.annotations.Test)25 LocalDate (java.time.LocalDate)9 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)4 DateTimeFormatter (java.time.format.DateTimeFormatter)3 Clock (java.time.Clock)2 Instant (java.time.Instant)2 ZoneId (java.time.ZoneId)2 Cache (com.google.common.cache.Cache)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 Subscribe (com.google.common.eventbus.Subscribe)1 IOException (java.io.IOException)1 YearMonth (java.time.YearMonth)1 java.util (java.util)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Collectors (java.util.stream.Collectors)1 JDOUserException (javax.jdo.JDOUserException)1 PersistenceManager (javax.jdo.PersistenceManager)1 Transaction (javax.jdo.Transaction)1