use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_equals_false_nano_differs.
@Test(dataProvider = "sampleTimes")
public void test_equals_false_nano_differs(int h, int m, int s, int n, ZoneOffset ignored) {
n = (n == 999999999 ? 999999998 : n);
OffsetTime a = OffsetTime.of(h, m, s, n, OFFSET_PONE);
OffsetTime b = OffsetTime.of(h, m, s, n + 1, OFFSET_PONE);
assertEquals(a.equals(b), false);
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method now_Clock_allSecsInDay.
//-----------------------------------------------------------------------
// now(Clock)
//-----------------------------------------------------------------------
@Test
public void now_Clock_allSecsInDay() {
for (int i = 0; i < (2 * 24 * 60 * 60); i++) {
Instant instant = Instant.ofEpochSecond(i, 8);
Clock clock = Clock.fixed(instant, ZoneOffset.UTC);
OffsetTime test = OffsetTime.now(clock);
assertEquals(test.getHour(), (i / (60 * 60)) % 24);
assertEquals(test.getMinute(), (i / 60) % 60);
assertEquals(test.getSecond(), i % 60);
assertEquals(test.getNano(), 8);
assertEquals(test.getOffset(), ZoneOffset.UTC);
}
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_toString.
@Test(dataProvider = "sampleToString")
public void test_toString(int h, int m, int s, int n, String offsetId, String expected) {
OffsetTime t = OffsetTime.of(h, m, s, n, ZoneOffset.of(offsetId));
String str = t.toString();
assertEquals(str, expected);
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_equals_false_offset_differs.
@Test(dataProvider = "sampleTimes")
public void test_equals_false_offset_differs(int h, int m, int s, int n, ZoneOffset ignored) {
OffsetTime a = OffsetTime.of(h, m, s, n, OFFSET_PONE);
OffsetTime b = OffsetTime.of(h, m, s, n, OFFSET_PTWO);
assertEquals(a.equals(b), false);
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method factory_ofInstant_maxYear.
//-----------------------------------------------------------------------
@Test
public void factory_ofInstant_maxYear() {
OffsetTime test = OffsetTime.ofInstant(Instant.MAX, ZoneOffset.UTC);
assertEquals(test.getHour(), 23);
assertEquals(test.getMinute(), 59);
assertEquals(test.getSecond(), 59);
assertEquals(test.getNano(), 999_999_999);
}
Aggregations