Search in sources :

Example 36 with LocalDateTime

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

the class TCKLocalDateTime method test_atOffset.

//-----------------------------------------------------------------------
// atOffset()
//-----------------------------------------------------------------------
@Test
public void test_atOffset() {
    LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30);
    assertEquals(t.atOffset(OFFSET_PTWO), OffsetDateTime.of(LocalDateTime.of(2008, 6, 30, 11, 30), OFFSET_PTWO));
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 37 with LocalDateTime

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

the class TCKLocalDateTime method test_atOffset_nullZoneOffset.

@Test(expectedExceptions = NullPointerException.class)
public void test_atOffset_nullZoneOffset() {
    LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30);
    t.atOffset((ZoneOffset) null);
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 38 with LocalDateTime

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

the class TCKLocalDateTime method test_plusDays_overLeapYears.

@Test
public void test_plusDays_overLeapYears() {
    LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusYears(-1).plusDays(365 + 366);
    check(t, 2008, 7, 15, 12, 30, 40, 987654321);
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 39 with LocalDateTime

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

the class TCKLocalDateTime method test_equals_false_day_differs.

@Test(dataProvider = "sampleDateTimes")
public void test_equals_false_day_differs(int y, int m, int d, int h, int mi, int s, int n) {
    LocalDateTime a = LocalDateTime.of(y, m, d, h, mi, s, n);
    LocalDateTime b = LocalDateTime.of(y, m, d + 1, h, mi, s, n);
    assertFalse(a.equals(b));
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 40 with LocalDateTime

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

the class TCKLocalDateTime method test_minusDays_normal.

@Test
public void test_minusDays_normal() {
    LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusDays(1);
    check(t, 2007, 7, 14, 12, 30, 40, 987654321);
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Aggregations

LocalDateTime (java.time.LocalDateTime)486 Test (org.testng.annotations.Test)282 Test (org.junit.Test)67 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)21 DateTimeFormatter (java.time.format.DateTimeFormatter)20 List (java.util.List)18 Date (java.util.Date)17 ZoneId (java.time.ZoneId)16 ArrayList (java.util.ArrayList)14 AbstractTCKTest (tck.java.time.AbstractTCKTest)14 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