Search in sources :

Example 51 with ZonedDateTime

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

the class TCKZonedDateTime method test_withEarlierOffsetAtOverlap_atOverlap.

@Test
public void test_withEarlierOffsetAtOverlap_atOverlap() {
    ZonedDateTime base = ZonedDateTime.ofStrict(TEST_PARIS_OVERLAP_2008_10_26_02_30, OFFSET_0100, ZONE_PARIS);
    ZonedDateTime test = base.withEarlierOffsetAtOverlap();
    // offset changed to earlier
    assertEquals(test.getOffset(), OFFSET_0200);
    // date-time not changed
    assertEquals(test.toLocalDateTime(), base.toLocalDateTime());
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 52 with ZonedDateTime

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

the class TCKZonedDateTime method now_Clock_allSecsInDay_utc.

@Test
public void now_Clock_allSecsInDay_utc() {
    for (int i = 0; i < (2 * 24 * 60 * 60); i++) {
        Instant instant = Instant.ofEpochSecond(i).plusNanos(123456789L);
        Clock clock = Clock.fixed(instant, ZoneOffset.UTC);
        ZonedDateTime test = ZonedDateTime.now(clock);
        assertEquals(test.getYear(), 1970);
        assertEquals(test.getMonth(), Month.JANUARY);
        assertEquals(test.getDayOfMonth(), (i < 24 * 60 * 60 ? 1 : 2));
        assertEquals(test.getHour(), (i / (60 * 60)) % 24);
        assertEquals(test.getMinute(), (i / 60) % 60);
        assertEquals(test.getSecond(), i % 60);
        assertEquals(test.getNano(), 123456789);
        assertEquals(test.getOffset(), ZoneOffset.UTC);
        assertEquals(test.getZone(), ZoneOffset.UTC);
    }
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Instant(java.time.Instant) Clock(java.time.Clock) Test(org.testng.annotations.Test)

Example 53 with ZonedDateTime

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

the class TCKZonedDateTime method test_withNanoOfSecond_noChange.

@Test
public void test_withNanoOfSecond_noChange() {
    ZonedDateTime base = ZonedDateTime.of(TEST_LOCAL_2008_06_30_11_30_59_500, ZONE_0100);
    ZonedDateTime test = base.withNano(500);
    assertEquals(test, base);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 54 with ZonedDateTime

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

the class TCKZonedDateTime method test_with_adjuster_OffsetDateTime_invalidOffsetIgnored.

@Test
public void test_with_adjuster_OffsetDateTime_invalidOffsetIgnored() {
    // ODT has invalid offset for ZDT, so only LDT is set
    OffsetDateTime odt = TEST_LOCAL_2008_06_30_11_30_59_500.atOffset(OFFSET_0130);
    ZonedDateTime zdt = TEST_PARIS_OVERLAP_2008_10_26_02_30.atZone(ZONE_PARIS);
    ZonedDateTime test = zdt.with(odt);
    assertEquals(test.toLocalDateTime(), TEST_LOCAL_2008_06_30_11_30_59_500);
    assertEquals(test.getOffset(), zdt.getOffset());
}
Also used : OffsetDateTime(java.time.OffsetDateTime) ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 55 with ZonedDateTime

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

the class TCKZonedDateTime method test_minusMinutes_minutes.

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

Aggregations

ZonedDateTime (java.time.ZonedDateTime)1375 Test (org.junit.Test)570 Test (org.testng.annotations.Test)182 LocalDateTime (java.time.LocalDateTime)136 ZoneId (java.time.ZoneId)122 Instant (java.time.Instant)112 ArrayList (java.util.ArrayList)102 Test (org.junit.jupiter.api.Test)93 LocalDate (java.time.LocalDate)84 DateTimeFormatter (java.time.format.DateTimeFormatter)77 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)76 List (java.util.List)75 Date (java.util.Date)63 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)46 AbstractCoreWorkflowIntegrationTest (eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest)44 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)43