Search in sources :

Example 96 with LocalDateTime

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

the class TestLocalDateTime method test_withNanoOfSecond_toMidnight.

@Test
public void test_withNanoOfSecond_toMidnight() {
    LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(0, 0, 0, 1)).withNano(0);
    assertSame(t.toLocalTime(), LocalTime.MIDNIGHT);
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 97 with LocalDateTime

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

the class TestLocalDateTime method test_minus_adjuster_zero.

@Test
public void test_minus_adjuster_zero() {
    LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minus(Period.ZERO);
    assertSame(t, TEST_2007_07_15_12_30_40_987654321);
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 98 with LocalDateTime

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

the class TestLocalDateTime method test_withNanoOfSecond_toMidday.

@Test
public void test_withNanoOfSecond_toMidday() {
    LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(12, 0, 0, 1)).withNano(0);
    assertSame(t.toLocalTime(), LocalTime.NOON);
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 99 with LocalDateTime

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

the class TestLocalDateTime method test_minus_Period_zero.

@Test
public void test_minus_Period_zero() {
    LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minus(MockSimplePeriod.ZERO_DAYS);
    assertSame(t, TEST_2007_07_15_12_30_40_987654321);
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 100 with LocalDateTime

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

the class TCKLocalDateTime method now_Clock_minYear.

@Test
public void now_Clock_minYear() {
    Clock clock = Clock.fixed(MIN_INSTANT, ZoneOffset.UTC);
    LocalDateTime test = LocalDateTime.now(clock);
    assertEquals(test, MIN_DATE_TIME);
}
Also used : LocalDateTime(java.time.LocalDateTime) Clock(java.time.Clock) Test(org.testng.annotations.Test)

Aggregations

LocalDateTime (java.time.LocalDateTime)399 Test (org.testng.annotations.Test)280 ZonedDateTime (java.time.ZonedDateTime)45 Test (org.junit.Test)40 LocalDate (java.time.LocalDate)33 ZoneOffsetTransition (java.time.zone.ZoneOffsetTransition)26 LocalTime (java.time.LocalTime)20 Instant (java.time.Instant)19 DateTimeFormatter (java.time.format.DateTimeFormatter)16 ZoneId (java.time.ZoneId)15 AbstractTCKTest (tck.java.time.AbstractTCKTest)14 OffsetDateTime (java.time.OffsetDateTime)10 ZoneRules (java.time.zone.ZoneRules)10 ZoneOffset (java.time.ZoneOffset)9 Date (java.util.Date)8 List (java.util.List)8 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 Timestamp (java.sql.Timestamp)6 ChronoLocalDateTime (java.time.chrono.ChronoLocalDateTime)6