Search in sources :

Example 56 with LocalDateTime

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

the class TCKZonedDateTime method test_with_adjuster_Year.

@Test
public void test_with_adjuster_Year() {
    LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0);
    ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100);
    ZonedDateTime test = base.with(Year.of(2007));
    assertEquals(test, ZonedDateTime.of(ldt.withYear(2007), ZONE_0100));
}
Also used : LocalDateTime(java.time.LocalDateTime) ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 57 with LocalDateTime

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

the class TCKZonedDateTime method test_withDayOfYear_noChange.

@Test
public void test_withDayOfYear_noChange() {
    LocalDateTime ldt = LocalDateTime.of(2008, 2, 5, 23, 30, 59, 0);
    ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100);
    ZonedDateTime test = base.withDayOfYear(36);
    assertEquals(test, base);
}
Also used : LocalDateTime(java.time.LocalDateTime) ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 58 with LocalDateTime

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

the class TCKZonedDateTime method test_minusWeeks.

//-----------------------------------------------------------------------
// minusWeeks()
//-----------------------------------------------------------------------
@Test
public void test_minusWeeks() {
    LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0);
    ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100);
    ZonedDateTime test = base.minusWeeks(1);
    assertEquals(test, ZonedDateTime.of(ldt.minusWeeks(1), ZONE_0100));
}
Also used : LocalDateTime(java.time.LocalDateTime) ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 59 with LocalDateTime

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

the class TCKZonedDateTime method factory_ofStrict_LDT_ZI_ZO.

//-----------------------------------------------------------------------
// ofStrict(LocalDateTime, ZoneId, ZoneOffset)
//-----------------------------------------------------------------------
@Test
public void factory_ofStrict_LDT_ZI_ZO() {
    LocalDateTime normal = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500);
    ZonedDateTime test = ZonedDateTime.ofStrict(normal, OFFSET_0200, ZONE_PARIS);
    check(test, 2008, 6, 30, 11, 30, 10, 500, OFFSET_0200, ZONE_PARIS);
}
Also used : LocalDateTime(java.time.LocalDateTime) ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 60 with LocalDateTime

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

the class TCKZonedDateTime method test_plusMonths.

//-----------------------------------------------------------------------
// plusMonths()
//-----------------------------------------------------------------------
@Test
public void test_plusMonths() {
    LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0);
    ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100);
    ZonedDateTime test = base.plusMonths(1);
    assertEquals(test, ZonedDateTime.of(ldt.plusMonths(1), ZONE_0100));
}
Also used : LocalDateTime(java.time.LocalDateTime) ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Aggregations

LocalDateTime (java.time.LocalDateTime)484 Test (org.testng.annotations.Test)282 Test (org.junit.Test)66 ZonedDateTime (java.time.ZonedDateTime)53 LocalDate (java.time.LocalDate)49 LocalTime (java.time.LocalTime)28 ZoneOffsetTransition (java.time.zone.ZoneOffsetTransition)26 Instant (java.time.Instant)20 DateTimeFormatter (java.time.format.DateTimeFormatter)20 List (java.util.List)18 Date (java.util.Date)17 ZoneId (java.time.ZoneId)16 AbstractTCKTest (tck.java.time.AbstractTCKTest)14 ArrayList (java.util.ArrayList)12 HashMap (java.util.HashMap)12 OffsetDateTime (java.time.OffsetDateTime)11 ZoneOffset (java.time.ZoneOffset)11 DateTimeParseException (java.time.format.DateTimeParseException)11 ZoneRules (java.time.zone.ZoneRules)10 IOException (java.io.IOException)9