Search in sources :

Example 81 with ZoneOffset

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

the class TCKZoneOffset method test_constant_MIN.

@Test
public void test_constant_MIN() {
    ZoneOffset test = ZoneOffset.MIN;
    doTestOffset(test, -18, 0, 0);
}
Also used : ZoneOffset(java.time.ZoneOffset) Test(org.junit.Test)

Example 82 with ZoneOffset

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

the class TCKZoneOffset method test_getTotalSeconds.

// -----------------------------------------------------------------------
// getTotalSeconds()
// -----------------------------------------------------------------------
@Test
public void test_getTotalSeconds() {
    ZoneOffset offset = ZoneOffset.ofTotalSeconds(60 * 60 + 1);
    assertEquals(offset.getTotalSeconds(), 60 * 60 + 1);
}
Also used : ZoneOffset(java.time.ZoneOffset) Test(org.junit.Test)

Example 83 with ZoneOffset

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

the class TCKZoneOffset method test_factory_string_hours.

@Test
public void test_factory_string_hours() {
    for (int i = -18; i <= 18; i++) {
        String str = (i < 0 ? "-" : "+") + Integer.toString(Math.abs(i) + 100).substring(1);
        ZoneOffset test = ZoneOffset.of(str);
        doTestOffset(test, i, 0, 0);
    }
}
Also used : ZoneOffset(java.time.ZoneOffset) Test(org.junit.Test)

Example 84 with ZoneOffset

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

the class TCKZoneOffset method test_factory_string_UTC.

// -----------------------------------------------------------------------
// of(String)
// -----------------------------------------------------------------------
@Test
public void test_factory_string_UTC() {
    String[] values = new String[] { "Z", "+0", "+00", "+0000", "+00:00", "+000000", "+00:00:00", "-00", "-0000", "-00:00", "-000000", "-00:00:00" };
    for (int i = 0; i < values.length; i++) {
        ZoneOffset test = ZoneOffset.of(values[i]);
        assertSame(test, ZoneOffset.UTC);
    }
}
Also used : ZoneOffset(java.time.ZoneOffset) Test(org.junit.Test)

Example 85 with ZoneOffset

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

the class TCKZoneOffset method test_factory_int_hours_minutes_seconds.

// -----------------------------------------------------------------------
@Test
public void test_factory_int_hours_minutes_seconds() {
    for (int i = -17; i <= 17; i++) {
        for (int j = -59; j <= 59; j++) {
            for (int k = -59; k <= 59; k++) {
                if ((i < 0 && j <= 0 && k <= 0) || (i > 0 && j >= 0 && k >= 0) || (i == 0 && ((j < 0 && k <= 0) || (j > 0 && k >= 0) || j == 0))) {
                    ZoneOffset test = ZoneOffset.ofHoursMinutesSeconds(i, j, k);
                    doTestOffset(test, i, j, k);
                }
            }
        }
    }
    ZoneOffset test1 = ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0);
    doTestOffset(test1, -18, 0, 0);
    ZoneOffset test2 = ZoneOffset.ofHoursMinutesSeconds(18, 0, 0);
    doTestOffset(test2, 18, 0, 0);
}
Also used : ZoneOffset(java.time.ZoneOffset) Test(org.junit.Test)

Aggregations

ZoneOffset (java.time.ZoneOffset)201 Test (org.junit.Test)51 LocalDateTime (java.time.LocalDateTime)36 ZoneId (java.time.ZoneId)36 Test (org.testng.annotations.Test)35 ZonedDateTime (java.time.ZonedDateTime)27 LocalTime (java.time.LocalTime)25 ZoneRules (java.time.zone.ZoneRules)23 OffsetDateTime (java.time.OffsetDateTime)20 Instant (java.time.Instant)17 LocalDate (java.time.LocalDate)16 TemporalAccessor (java.time.temporal.TemporalAccessor)11 ZoneOffsetTransition (java.time.zone.ZoneOffsetTransition)11 OffsetTime (java.time.OffsetTime)10 DateTimeFormatter (java.time.format.DateTimeFormatter)10 ArrayList (java.util.ArrayList)8 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)7 List (java.util.List)6 BigDecimal (java.math.BigDecimal)5 Clock (java.time.Clock)5