Search in sources :

Example 61 with ZoneOffsetTransitionRule

use of java.time.zone.ZoneOffsetTransitionRule in project j2objc by google.

the class TCKZoneOffsetTransitionRuleSerialization method test_serialization_floatingWeek.

@Test
public void test_serialization_floatingWeek() throws Exception {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertSerializable(test);
}
Also used : ZoneOffsetTransitionRule(java.time.zone.ZoneOffsetTransitionRule) Test(org.junit.Test) AbstractTCKTest(tck.java.time.AbstractTCKTest)

Example 62 with ZoneOffsetTransitionRule

use of java.time.zone.ZoneOffsetTransitionRule in project j2objc by google.

the class TCKZoneRules method test_London_getTransitionRules.

public void test_London_getTransitionRules() {
    ZoneRules test = europeLondon();
    List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
    assertEquals(rules.size(), 2);
    ZoneOffsetTransitionRule in = rules.get(0);
    assertEquals(in.getMonth(), Month.MARCH);
    // Android-changed: check for -1, which matches the data, we don't do the "optimization"
    // optimized from -1
    assertEquals(in.getDayOfMonthIndicator(), -1);
    assertEquals(in.getDayOfWeek(), DayOfWeek.SUNDAY);
    assertEquals(in.getLocalTime(), LocalTime.of(1, 0));
    assertEquals(in.getTimeDefinition(), TimeDefinition.UTC);
    assertEquals(in.getStandardOffset(), OFFSET_ZERO);
    assertEquals(in.getOffsetBefore(), OFFSET_ZERO);
    assertEquals(in.getOffsetAfter(), OFFSET_PONE);
    ZoneOffsetTransitionRule out = rules.get(1);
    assertEquals(out.getMonth(), Month.OCTOBER);
    // Android-changed: check for -1, which matches the data, we don't do the "optimization"
    // optimized from -1
    assertEquals(out.getDayOfMonthIndicator(), -1);
    assertEquals(out.getDayOfWeek(), DayOfWeek.SUNDAY);
    assertEquals(out.getLocalTime(), LocalTime.of(1, 0));
    assertEquals(out.getTimeDefinition(), TimeDefinition.UTC);
    assertEquals(out.getStandardOffset(), OFFSET_ZERO);
    assertEquals(out.getOffsetBefore(), OFFSET_PONE);
    assertEquals(out.getOffsetAfter(), OFFSET_ZERO);
}
Also used : ZoneOffsetTransitionRule(java.time.zone.ZoneOffsetTransitionRule) ZoneRules(java.time.zone.ZoneRules)

Example 63 with ZoneOffsetTransitionRule

use of java.time.zone.ZoneOffsetTransitionRule in project j2objc by google.

the class TCKZoneOffsetTransitionRule method test_toString_floatingWeek_gap_notEndOfDay.

// -----------------------------------------------------------------------
// toString()
// -----------------------------------------------------------------------
@Test
public void test_toString_floatingWeek_gap_notEndOfDay() {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(test.toString(), "TransitionRule[Gap +02:00 to +03:00, SUNDAY on or after MARCH 20 at 01:00 WALL, standard offset +02:00]");
}
Also used : ZoneOffsetTransitionRule(java.time.zone.ZoneOffsetTransitionRule) Test(org.junit.Test) AbstractTCKTest(tck.java.time.AbstractTCKTest)

Example 64 with ZoneOffsetTransitionRule

use of java.time.zone.ZoneOffsetTransitionRule in project j2objc by google.

the class TCKZoneOffsetTransitionRule method test_equals_monthDifferent.

// -----------------------------------------------------------------------
// equals()
// -----------------------------------------------------------------------
@Test
public void test_equals_monthDifferent() {
    ZoneOffsetTransitionRule a = ZoneOffsetTransitionRule.of(Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, OFFSET_0200, OFFSET_0200, OFFSET_0300);
    ZoneOffsetTransitionRule b = ZoneOffsetTransitionRule.of(Month.APRIL, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL, OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(a.equals(a), true);
    assertEquals(a.equals(b), false);
    assertEquals(b.equals(a), false);
    assertEquals(b.equals(b), true);
}
Also used : ZoneOffsetTransitionRule(java.time.zone.ZoneOffsetTransitionRule) Test(org.junit.Test) AbstractTCKTest(tck.java.time.AbstractTCKTest)

Example 65 with ZoneOffsetTransitionRule

use of java.time.zone.ZoneOffsetTransitionRule in project j2objc by google.

the class TCKZoneOffsetTransitionRule method test_toString_fixedDate.

@Test
public void test_toString_fixedDate() {
    ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD, OFFSET_0200, OFFSET_0200, OFFSET_0300);
    assertEquals(test.toString(), "TransitionRule[Gap +02:00 to +03:00, MARCH 20 at 01:00 STANDARD, standard offset +02:00]");
}
Also used : ZoneOffsetTransitionRule(java.time.zone.ZoneOffsetTransitionRule) Test(org.junit.Test) AbstractTCKTest(tck.java.time.AbstractTCKTest)

Aggregations

ZoneOffsetTransitionRule (java.time.zone.ZoneOffsetTransitionRule)84 AbstractTCKTest (tck.java.time.AbstractTCKTest)72 Test (org.junit.Test)36 Test (org.testng.annotations.Test)36 ZoneOffsetTransition (java.time.zone.ZoneOffsetTransition)22 ZoneRules (java.time.zone.ZoneRules)10 Instant (java.time.Instant)2 LocalDateTime (java.time.LocalDateTime)2 OffsetDateTime (java.time.OffsetDateTime)2 ZoneId (java.time.ZoneId)2 ZoneOffset (java.time.ZoneOffset)2 ZonedDateTime (java.time.ZonedDateTime)2 TimeDefinition (java.time.zone.ZoneOffsetTransitionRule.TimeDefinition)2 ArrayList (java.util.ArrayList)2 RuntimeMXBean (java.lang.management.RuntimeMXBean)1 ThreadMXBean (java.lang.management.ThreadMXBean)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1