Search in sources :

Example 76 with LocalDateTime

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

the class TestLocalDateTime method test_minusSeconds_toMidnight.

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

Example 77 with LocalDateTime

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

the class TestLocalDateTime method test_getTime.

//-----------------------------------------------------------------------
// toLocalTime()
//-----------------------------------------------------------------------
@Test(dataProvider = "sampleTimes")
public void test_getTime(int h, int m, int s, int ns) {
    LocalTime t = LocalTime.of(h, m, s, ns);
    LocalDateTime dt = LocalDateTime.of(LocalDate.of(2011, 7, 30), t);
    assertSame(dt.toLocalTime(), t);
}
Also used : LocalDateTime(java.time.LocalDateTime) LocalTime(java.time.LocalTime) Test(org.testng.annotations.Test)

Example 78 with LocalDateTime

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

the class TestLocalDateTime method test_plusHours_noChange.

@Test
public void test_plusHours_noChange() {
    LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusHours(0);
    assertSame(t, TEST_2007_07_15_12_30_40_987654321);
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 79 with LocalDateTime

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

the class TestLocalDateTime method test_plusWeeks_noChange.

@Test
public void test_plusWeeks_noChange() {
    LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusWeeks(0);
    assertSame(t, TEST_2007_07_15_12_30_40_987654321);
}
Also used : LocalDateTime(java.time.LocalDateTime) Test(org.testng.annotations.Test)

Example 80 with LocalDateTime

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

the class TestLocalDateTime method test_withMinute_noChange.

@Test
public void test_withMinute_noChange() {
    LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.withMinute(30);
    assertSame(t, TEST_2007_07_15_12_30_40_987654321);
}
Also used : LocalDateTime(java.time.LocalDateTime) 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