Search in sources :

Example 46 with ZonedDateTime

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

the class TCKZonedDateTime method test_with_adjuster_LocalTime.

@Test
public void test_with_adjuster_LocalTime() {
    ZonedDateTime base = ZonedDateTime.of(TEST_PARIS_OVERLAP_2008_10_26_02_30, ZONE_PARIS);
    ZonedDateTime test = base.with(LocalTime.of(2, 29));
    check(test, 2008, 10, 26, 2, 29, 0, 0, OFFSET_0200, ZONE_PARIS);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 47 with ZonedDateTime

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

the class TCKZonedDateTime method test_withZoneSameLocal_retainOffset1.

@Test
public void test_withZoneSameLocal_retainOffset1() {
    // overlap
    LocalDateTime ldt = LocalDateTime.of(2008, 11, 2, 1, 30, 59, 0);
    ZonedDateTime base = ZonedDateTime.of(ldt, ZoneId.of("UTC-04:00"));
    ZonedDateTime test = base.withZoneSameLocal(ZoneId.of("America/New_York"));
    assertEquals(base.getOffset(), ZoneOffset.ofHours(-4));
    assertEquals(test.getOffset(), ZoneOffset.ofHours(-4));
}
Also used : LocalDateTime(java.time.LocalDateTime) ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 48 with ZonedDateTime

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

the class TCKDateTimeParseResolver method test_fieldResolvesToChronoZonedDateTime_overrideZone_matches.

@Test
public void test_fieldResolvesToChronoZonedDateTime_overrideZone_matches() {
    ZonedDateTime zdt = ZonedDateTime.of(2010, 6, 30, 12, 30, 0, 0, EUROPE_PARIS);
    DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(zdt)).toFormatter();
    f = f.withZone(EUROPE_PARIS);
    assertEquals(f.parse("1234567890", ZonedDateTime::from), zdt);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) ChronoZonedDateTime(java.time.chrono.ChronoZonedDateTime) DateTimeFormatter(java.time.format.DateTimeFormatter) DateTimeFormatterBuilder(java.time.format.DateTimeFormatterBuilder) Test(org.testng.annotations.Test)

Example 49 with ZonedDateTime

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

the class TCKZonedDateTime method test_equals_true.

//-----------------------------------------------------------------------
// equals() / hashCode()
//-----------------------------------------------------------------------
@Test(dataProvider = "sampleTimes")
public void test_equals_true(int y, int o, int d, int h, int m, int s, int n, ZoneId ignored) {
    ZonedDateTime a = ZonedDateTime.of(dateTime(y, o, d, h, m, s, n), ZONE_0100);
    ZonedDateTime b = ZonedDateTime.of(dateTime(y, o, d, h, m, s, n), ZONE_0100);
    assertEquals(a.equals(b), true);
    assertEquals(a.hashCode() == b.hashCode(), true);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 50 with ZonedDateTime

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

the class TCKZonedDateTime method now_ZoneId.

@Test
public void now_ZoneId() {
    ZoneId zone = ZoneId.of("UTC+01:02:03");
    ZonedDateTime expected = ZonedDateTime.now(Clock.system(zone));
    ZonedDateTime test = ZonedDateTime.now(zone);
    for (int i = 0; i < 100; i++) {
        if (expected.equals(test)) {
            return;
        }
        expected = ZonedDateTime.now(Clock.system(zone));
        test = ZonedDateTime.now(zone);
    }
    assertEquals(test, expected);
}
Also used : ZoneId(java.time.ZoneId) 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