Java Code Examples for java.time.Clock#offset()
The following examples show how to use
java.time.Clock#offset() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TCKClock_Offset.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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); }
Example 2
Source File: TCKClock_Offset.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void test_offset_ClockDuration() { Clock test = Clock.offset(Clock.fixed(INSTANT, PARIS), OFFSET); //System.out.println(test.instant()); //System.out.println(INSTANT.plus(OFFSET)); assertEquals(test.instant(), INSTANT.plus(OFFSET)); assertEquals(test.getZone(), PARIS); }
Example 3
Source File: TCKClock_Offset.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void test_hashCode() { Clock a = Clock.offset(Clock.system(PARIS), OFFSET); Clock b = Clock.offset(Clock.system(PARIS), OFFSET); assertEquals(a.hashCode(), a.hashCode()); assertEquals(a.hashCode(), b.hashCode()); Clock c = Clock.offset(Clock.system(MOSCOW), OFFSET); assertEquals(a.hashCode() == c.hashCode(), false); Clock d = Clock.offset(Clock.system(PARIS), OFFSET.minusNanos(1)); assertEquals(a.hashCode() == d.hashCode(), false); }
Example 4
Source File: TCKClock_Offset.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void test_hashCode() { Clock a = Clock.offset(Clock.system(PARIS), OFFSET); Clock b = Clock.offset(Clock.system(PARIS), OFFSET); assertEquals(a.hashCode(), a.hashCode()); assertEquals(a.hashCode(), b.hashCode()); Clock c = Clock.offset(Clock.system(MOSCOW), OFFSET); assertEquals(a.hashCode() == c.hashCode(), false); Clock d = Clock.offset(Clock.system(PARIS), OFFSET.minusNanos(1)); assertEquals(a.hashCode() == d.hashCode(), false); }
Example 5
Source File: TCKClock_Offset.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public void test_hashCode() { Clock a = Clock.offset(Clock.system(PARIS), OFFSET); Clock b = Clock.offset(Clock.system(PARIS), OFFSET); assertEquals(a.hashCode(), a.hashCode()); assertEquals(a.hashCode(), b.hashCode()); Clock c = Clock.offset(Clock.system(MOSCOW), OFFSET); assertEquals(a.hashCode() == c.hashCode(), false); Clock d = Clock.offset(Clock.system(PARIS), OFFSET.minusNanos(1)); assertEquals(a.hashCode() == d.hashCode(), false); }
Example 6
Source File: TCKClock_Offset.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void test_hashCode() { Clock a = Clock.offset(Clock.system(PARIS), OFFSET); Clock b = Clock.offset(Clock.system(PARIS), OFFSET); assertEquals(a.hashCode(), a.hashCode()); assertEquals(a.hashCode(), b.hashCode()); Clock c = Clock.offset(Clock.system(MOSCOW), OFFSET); assertEquals(a.hashCode() == c.hashCode(), false); Clock d = Clock.offset(Clock.system(PARIS), OFFSET.minusNanos(1)); assertEquals(a.hashCode() == d.hashCode(), false); }
Example 7
Source File: TestClock_Offset.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public void test_toString() { Clock test = Clock.offset(Clock.systemUTC(), OFFSET); assertEquals(test.toString(), "OffsetClock[SystemClock[Z],PT2S]"); }
Example 8
Source File: TestClock_Offset.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone_same() { Clock test = Clock.offset(Clock.system(PARIS), OFFSET); Clock changed = test.withZone(PARIS); assertSame(test, changed); }
Example 9
Source File: TestClock_Offset.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void test_withZone_same() { Clock test = Clock.offset(Clock.system(PARIS), OFFSET); Clock changed = test.withZone(PARIS); assertSame(test, changed); }
Example 10
Source File: TCKClock_Offset.java From j2objc with Apache License 2.0 | 4 votes |
@Test(expected = NullPointerException.class) public void test_offset_ClockDuration_nullDuration() { Clock.offset(Clock.systemUTC(), null); }
Example 11
Source File: TestClock_Offset.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public void test_toString() { Clock test = Clock.offset(Clock.systemUTC(), OFFSET); assertEquals(test.toString(), "OffsetClock[SystemClock[Z],PT2S]"); }
Example 12
Source File: TCKClock_Offset.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void test_offset_ClockDuration_nullDuration() { Clock.offset(Clock.systemUTC(), null); }
Example 13
Source File: TCKClock_Offset.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.offset(Clock.system(PARIS), OFFSET); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 14
Source File: TCKClock_Offset.java From hottub with GNU General Public License v2.0 | 4 votes |
public void test_offset_ClockDuration_zeroDuration() { Clock underlying = Clock.system(PARIS); Clock test = Clock.offset(underlying, Duration.ZERO); assertSame(test, underlying); // spec says same }
Example 15
Source File: TestClock_Offset.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_toString() { Clock test = Clock.offset(Clock.systemUTC(), OFFSET); assertEquals(test.toString(), "OffsetClock[SystemClock[Z],PT2S]"); }
Example 16
Source File: TCKClock_Offset.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void test_offset_ClockDuration_nullDuration() { Clock.offset(Clock.systemUTC(), null); }
Example 17
Source File: TCKClock_Offset.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.offset(Clock.system(PARIS), OFFSET); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 18
Source File: TestClock_Offset.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void test_withZone_same() { Clock test = Clock.offset(Clock.system(PARIS), OFFSET); Clock changed = test.withZone(PARIS); assertSame(test, changed); }
Example 19
Source File: TCKClock_Offset.java From j2objc with Apache License 2.0 | 4 votes |
public void test_offset_ClockDuration_zeroDuration() { Clock underlying = Clock.system(PARIS); Clock test = Clock.offset(underlying, Duration.ZERO); assertSame(test, underlying); // spec says same }
Example 20
Source File: TCKClock_Offset.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void test_offset_ClockDuration_nullDuration() { Clock.offset(Clock.systemUTC(), null); }