use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_equals_true.
//-----------------------------------------------------------------------
// equals() / hashCode()
//-----------------------------------------------------------------------
@Test(dataProvider = "sampleTimes")
public void test_equals_true(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_PONE);
assertEquals(a.equals(b), true);
assertEquals(a.hashCode() == b.hashCode(), true);
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_equals_false_minute_differs.
@Test(dataProvider = "sampleTimes")
public void test_equals_false_minute_differs(int h, int m, int s, int n, ZoneOffset ignored) {
m = (m == 59 ? 58 : m);
OffsetTime a = OffsetTime.of(h, m, s, n, OFFSET_PONE);
OffsetTime b = OffsetTime.of(h, m + 1, s, n, OFFSET_PONE);
assertEquals(a.equals(b), false);
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_minusSeconds.
//-----------------------------------------------------------------------
// minusSeconds()
//-----------------------------------------------------------------------
@Test
public void test_minusSeconds() {
OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
OffsetTime test = base.minusSeconds(60);
assertEquals(test, OffsetTime.of(11, 29, 59, 0, OFFSET_PONE));
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method now_Clock_offsets.
@Test
public void now_Clock_offsets() {
Instant base = LocalDateTime.of(1970, 1, 1, 12, 0).toInstant(ZoneOffset.UTC);
for (int i = -9; i < 15; i++) {
ZoneOffset offset = ZoneOffset.ofHours(i);
Clock clock = Clock.fixed(base, offset);
OffsetTime test = OffsetTime.now(clock);
assertEquals(test.getHour(), (12 + i) % 24);
assertEquals(test.getMinute(), 0);
assertEquals(test.getSecond(), 0);
assertEquals(test.getNano(), 0);
assertEquals(test.getOffset(), offset);
}
}
use of java.time.OffsetTime in project jdk8u_jdk by JetBrains.
the class TCKOffsetTime method test_minusMinutes_zero.
@Test
public void test_minusMinutes_zero() {
OffsetTime base = OffsetTime.of(11, 30, 59, 0, OFFSET_PONE);
OffsetTime test = base.minusMinutes(0);
assertEquals(test, base);
}
Aggregations