Search in sources :

Example 31 with ZonedDateTime

use of java.time.ZonedDateTime 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)

Example 32 with ZonedDateTime

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

the class TCKZonedDateTime method factory_parse_formatter.

//-----------------------------------------------------------------------
// parse(DateTimeFormatter)
//-----------------------------------------------------------------------
@Test
public void factory_parse_formatter() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("y M d H m s VV");
    ZonedDateTime test = ZonedDateTime.parse("2010 12 3 11 30 0 Europe/London", f);
    assertEquals(test, ZonedDateTime.of(LocalDateTime.of(2010, 12, 3, 11, 30), ZoneId.of("Europe/London")));
}
Also used : ZonedDateTime(java.time.ZonedDateTime) DateTimeFormatter(java.time.format.DateTimeFormatter) Test(org.testng.annotations.Test)

Example 33 with ZonedDateTime

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

the class TCKZonedDateTime method test_with_adjuster_OffsetDateTime_retainOffsetInOverlap1.

@Test
public void test_with_adjuster_OffsetDateTime_retainOffsetInOverlap1() {
    // ODT will be a valid ZDT for the zone, so must be retained exactly
    OffsetDateTime odt = TEST_PARIS_OVERLAP_2008_10_26_02_30.atOffset(OFFSET_0100);
    ZonedDateTime zdt = TEST_LOCAL_2008_06_30_11_30_59_500.atZone(ZONE_PARIS);
    ZonedDateTime test = zdt.with(odt);
    assertEquals(test.toOffsetDateTime(), odt);
}
Also used : OffsetDateTime(java.time.OffsetDateTime) ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 34 with ZonedDateTime

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

the class TCKZonedDateTime method now_Clock_allSecsInDay_zone.

@Test
public void now_Clock_allSecsInDay_zone() {
    ZoneId zone = ZoneId.of("Europe/London");
    for (int i = 0; i < (2 * 24 * 60 * 60); i++) {
        Instant instant = Instant.ofEpochSecond(i).plusNanos(123456789L);
        ZonedDateTime expected = ZonedDateTime.ofInstant(instant, zone);
        Clock clock = Clock.fixed(expected.toInstant(), zone);
        ZonedDateTime test = ZonedDateTime.now(clock);
        assertEquals(test, expected);
    }
}
Also used : ZoneId(java.time.ZoneId) ZonedDateTime(java.time.ZonedDateTime) Instant(java.time.Instant) Clock(java.time.Clock) Test(org.testng.annotations.Test)

Example 35 with ZonedDateTime

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

the class TCKZonedDateTime method test_withZoneSameLocal.

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

Aggregations

ZonedDateTime (java.time.ZonedDateTime)1461 Test (org.junit.Test)622 Test (org.testng.annotations.Test)182 LocalDateTime (java.time.LocalDateTime)145 ZoneId (java.time.ZoneId)129 Instant (java.time.Instant)114 ArrayList (java.util.ArrayList)104 Test (org.junit.jupiter.api.Test)96 LocalDate (java.time.LocalDate)90 List (java.util.List)80 DateTimeFormatter (java.time.format.DateTimeFormatter)78 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)76 Date (java.util.Date)66 IOException (java.io.IOException)58 UUID (java.util.UUID)58 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)54 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)53 HashMap (java.util.HashMap)47 AbstractCoreWorkflowIntegrationTest (eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest)44 OffsetDateTime (java.time.OffsetDateTime)44