Search in sources :

Example 81 with OffsetDateTime

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

the class TCKOffsetDateTime method test_plusMinutes.

//-----------------------------------------------------------------------
// plusMinutes()
//-----------------------------------------------------------------------
@Test
public void test_plusMinutes() {
    OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(30);
    assertEquals(test, OffsetDateTime.of(2008, 6, 30, 12, 0, 59, 0, OFFSET_PONE));
}
Also used : OffsetDateTime(java.time.OffsetDateTime) Test(org.testng.annotations.Test)

Example 82 with OffsetDateTime

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

the class TCKOffsetDateTime method test_withOffsetSameLocal_null.

@Test(expectedExceptions = NullPointerException.class)
public void test_withOffsetSameLocal_null() {
    OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
    base.withOffsetSameLocal(null);
}
Also used : OffsetDateTime(java.time.OffsetDateTime) Test(org.testng.annotations.Test)

Example 83 with OffsetDateTime

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

the class TCKOffsetDateTime method test_isBeforeIsAfterIsEqual1.

//-----------------------------------------------------------------------
// isAfter() / isBefore() / isEqual()
//-----------------------------------------------------------------------
@Test
public void test_isBeforeIsAfterIsEqual1() {
    OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 58, 3, OFFSET_PONE);
    // a is before b due to time
    OffsetDateTime b = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 2, OFFSET_PONE);
    assertEquals(a.isBefore(b), true);
    assertEquals(a.isEqual(b), false);
    assertEquals(a.isAfter(b), false);
    assertEquals(b.isBefore(a), false);
    assertEquals(b.isEqual(a), false);
    assertEquals(b.isAfter(a), true);
    assertEquals(a.isBefore(a), false);
    assertEquals(b.isBefore(b), false);
    assertEquals(a.isEqual(a), true);
    assertEquals(b.isEqual(b), true);
    assertEquals(a.isAfter(a), false);
    assertEquals(b.isAfter(b), false);
}
Also used : OffsetDateTime(java.time.OffsetDateTime) Test(org.testng.annotations.Test)

Example 84 with OffsetDateTime

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

the class TCKOffsetDateTime method test_minus_Duration_zero.

@Test
public void test_minus_Duration_zero() {
    OffsetDateTime t = TEST_2008_6_30_11_30_59_000000500.minus(Duration.ZERO);
    assertEquals(t, TEST_2008_6_30_11_30_59_000000500);
}
Also used : OffsetDateTime(java.time.OffsetDateTime) Test(org.testng.annotations.Test)

Example 85 with OffsetDateTime

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

the class TCKOffsetDateTime method test_atZoneSimilarLocal.

//-----------------------------------------------------------------------
// atZoneSimilarLocal()
//-----------------------------------------------------------------------
@Test
public void test_atZoneSimilarLocal() {
    OffsetDateTime t = OffsetDateTime.of(2008, 6, 30, 11, 30, 0, 0, OFFSET_MTWO);
    assertEquals(t.atZoneSimilarLocal(ZONE_PARIS), ZonedDateTime.of(2008, 6, 30, 11, 30, 0, 0, ZONE_PARIS));
}
Also used : OffsetDateTime(java.time.OffsetDateTime) Test(org.testng.annotations.Test)

Aggregations

OffsetDateTime (java.time.OffsetDateTime)199 Test (org.testng.annotations.Test)139 Test (org.junit.Test)26 Instant (java.time.Instant)22 ZonedDateTime (java.time.ZonedDateTime)18 LocalDateTime (java.time.LocalDateTime)13 LocalDate (java.time.LocalDate)12 LocalTime (java.time.LocalTime)11 OffsetTime (java.time.OffsetTime)7 Map (java.util.Map)7 Timestamp (java.sql.Timestamp)6 ChronoZonedDateTime (java.time.chrono.ChronoZonedDateTime)6 ZoneOffset (java.time.ZoneOffset)5 Date (java.sql.Date)4 Clock (java.time.Clock)4 Duration (java.time.Duration)4 DateTimeFormatter (java.time.format.DateTimeFormatter)4 Collections.emptyMap (java.util.Collections.emptyMap)4 UUID (java.util.UUID)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4