Search in sources :

Example 36 with ZonedDateTime

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

the class TCKZonedDateTime method test_equals_false_hour_differs.

@Test(dataProvider = "sampleTimes")
public void test_equals_false_hour_differs(int y, int o, int d, int h, int m, int s, int n, ZoneId ignored) {
    h = (h == 23 ? 22 : h);
    ZonedDateTime a = ZonedDateTime.of(dateTime(y, o, d, h, m, s, n), ZONE_0100);
    ZonedDateTime b = ZonedDateTime.of(dateTime(y, o, d, h + 1, m, s, n), ZONE_0100);
    assertEquals(a.equals(b), false);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 37 with ZonedDateTime

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

the class TCKZonedDateTime method test_minus_TemporalAmount_Duration.

@Test
public void test_minus_TemporalAmount_Duration() {
    Duration duration = Duration.ofSeconds(4L * 60 * 60 + 5L * 60 + 6L);
    ZonedDateTime t = ZonedDateTime.of(LocalDateTime.of(2008, 6, 1, 12, 30, 59, 500), ZONE_0100);
    ZonedDateTime expected = ZonedDateTime.of(LocalDateTime.of(2008, 6, 1, 8, 25, 53, 500), ZONE_0100);
    assertEquals(t.minus(duration), expected);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Duration(java.time.Duration) Test(org.testng.annotations.Test)

Example 38 with ZonedDateTime

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

the class TCKZonedDateTime method test_isBefore_null.

@Test(expectedExceptions = NullPointerException.class)
public void test_isBefore_null() {
    ZonedDateTime a = ZonedDateTime.of(2008, 6, 30, 23, 30, 59, 0, ZONE_0100);
    a.isBefore(null);
}
Also used : ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 39 with ZonedDateTime

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

the class TCKZonedDateTime method test_toEpochSecond_afterEpoch.

//-----------------------------------------------------------------------
// toEpochSecond()
//-----------------------------------------------------------------------
@Test
public void test_toEpochSecond_afterEpoch() {
    LocalDateTime ldt = LocalDateTime.of(1970, 1, 1, 0, 0).plusHours(1);
    for (int i = 0; i < 100000; i++) {
        ZonedDateTime a = ZonedDateTime.of(ldt, ZONE_PARIS);
        assertEquals(a.toEpochSecond(), i);
        ldt = ldt.plusSeconds(1);
    }
}
Also used : LocalDateTime(java.time.LocalDateTime) ZonedDateTime(java.time.ZonedDateTime) Test(org.testng.annotations.Test)

Example 40 with ZonedDateTime

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

the class TCKZonedDateTime method test_isAfter.

@Test(dataProvider = "IsAfter")
public void test_isAfter(int hour1, int minute1, ZoneId zone1, int hour2, int minute2, ZoneId zone2, boolean expected) {
    ZonedDateTime a = ZonedDateTime.of(2008, 6, 30, hour1, minute1, 0, 0, zone1);
    ZonedDateTime b = ZonedDateTime.of(2008, 6, 30, hour2, minute2, 0, 0, zone2);
    assertEquals(a.isAfter(b), expected);
    assertEquals(b.isAfter(a), false);
    assertEquals(a.isAfter(a), false);
    assertEquals(b.isAfter(b), false);
}
Also used : 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