Search in sources :

Example 76 with Clock

use of java.time.Clock in project j2objc by google.

the class TCKClock_Offset method test_equals.

// -----------------------------------------------------------------------
public void test_equals() {
    Clock a = Clock.offset(Clock.system(PARIS), OFFSET);
    Clock b = Clock.offset(Clock.system(PARIS), OFFSET);
    assertEquals(a.equals(a), true);
    assertEquals(a.equals(b), true);
    assertEquals(b.equals(a), true);
    assertEquals(b.equals(b), true);
    Clock c = Clock.offset(Clock.system(MOSCOW), OFFSET);
    assertEquals(a.equals(c), false);
    Clock d = Clock.offset(Clock.system(PARIS), OFFSET.minusNanos(1));
    assertEquals(a.equals(d), false);
    assertEquals(a.equals(null), false);
    assertEquals(a.equals("other type"), false);
    assertEquals(a.equals(Clock.systemUTC()), false);
}
Also used : Clock(java.time.Clock)

Example 77 with Clock

use of java.time.Clock in project j2objc by google.

the class TCKClock_Offset method test_withZone_equal.

public void test_withZone_equal() {
    Clock test = Clock.offset(Clock.system(PARIS), OFFSET);
    Clock changed = test.withZone(PARIS);
    assertEquals(test, changed);
}
Also used : Clock(java.time.Clock)

Example 78 with Clock

use of java.time.Clock in project j2objc by google.

the class TCKClock_System method test_system_ZoneId.

public void test_system_ZoneId() {
    Clock test = Clock.system(PARIS);
    assertEquals(test.getZone(), PARIS);
}
Also used : Clock(java.time.Clock)

Example 79 with Clock

use of java.time.Clock in project j2objc by google.

the class TCKClock_System method test_systemUTC.

// -------------------------------------------------------------------------
public void test_systemUTC() {
    Clock test = Clock.systemUTC();
    assertEquals(test.getZone(), ZoneOffset.UTC);
    assertEquals(test, Clock.system(ZoneOffset.UTC));
}
Also used : Clock(java.time.Clock)

Example 80 with Clock

use of java.time.Clock in project j2objc by google.

the class TCKClock_Tick method test_withZone.

// -------------------------------------------------------------------------
public void test_withZone() {
    Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500));
    Clock changed = test.withZone(MOSCOW);
    assertEquals(test.getZone(), PARIS);
    assertEquals(changed.getZone(), MOSCOW);
}
Also used : Clock(java.time.Clock)

Aggregations

Clock (java.time.Clock)209 Test (org.junit.Test)62 Instant (java.time.Instant)51 Test (org.testng.annotations.Test)43 LocalTime (java.time.LocalTime)15 ZonedDateTime (java.time.ZonedDateTime)12 LocalDateTime (java.time.LocalDateTime)11 ZoneId (java.time.ZoneId)11 LocalDate (java.time.LocalDate)10 OffsetDateTime (java.time.OffsetDateTime)8 Test (org.junit.jupiter.api.Test)7 HandlerTest (com.yahoo.vespa.config.server.http.HandlerTest)6 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)6 IOException (java.io.IOException)6 SessionTest (com.yahoo.vespa.config.server.session.SessionTest)5 OffsetTime (java.time.OffsetTime)5 ZoneOffset (java.time.ZoneOffset)5 Chronology (java.time.chrono.Chronology)5 IsoChronology (java.time.chrono.IsoChronology)5 Date (java.util.Date)4