Java Code Examples for java.time.Clock#tick()
The following examples show how to use
java.time.Clock#tick() .
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_Tick.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void test_hashCode() { Clock a = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock b = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); assertEquals(a.hashCode(), a.hashCode()); assertEquals(a.hashCode(), b.hashCode()); Clock c = Clock.tick(Clock.system(MOSCOW), Duration.ofMillis(500)); assertEquals(a.hashCode() == c.hashCode(), false); Clock d = Clock.tick(Clock.system(PARIS), Duration.ofMillis(499)); assertEquals(a.hashCode() == d.hashCode(), false); }
Example 2
Source File: TCKClock_Tick.java From hottub with GNU General Public License v2.0 | 5 votes |
public void test_hashCode() { Clock a = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock b = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); assertEquals(a.hashCode(), a.hashCode()); assertEquals(a.hashCode(), b.hashCode()); Clock c = Clock.tick(Clock.system(MOSCOW), Duration.ofMillis(500)); assertEquals(a.hashCode() == c.hashCode(), false); Clock d = Clock.tick(Clock.system(PARIS), Duration.ofMillis(499)); assertEquals(a.hashCode() == d.hashCode(), false); }
Example 3
Source File: TCKClock_Tick.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 4
Source File: TCKClock_Tick.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = IllegalArgumentException.class) public void test_tick_ClockDuration_negative1ns() { Clock.tick(Clock.systemUTC(), Duration.ofSeconds(0, -1)); }
Example 5
Source File: TestClock_Tick.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_toString() { Clock test = Clock.tick(Clock.systemUTC(), Duration.ofMillis(500)); assertEquals(test.toString(), "TickClock[SystemClock[Z],PT0.5S]"); }
Example 6
Source File: TCKClock_Tick.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 7
Source File: TCKClock_Tick.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void test_tick_ClockDuration_nullDuration() { Clock.tick(Clock.systemUTC(), null); }
Example 8
Source File: TCKClock_Tick.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void test_withZone_equal() { Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock changed = test.withZone(PARIS); assertEquals(test, changed); }
Example 9
Source File: TCKClock_Tick.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = IllegalArgumentException.class) public void test_tick_ClockDuration_subMilliNotDivisible_123ns() { Clock.tick(Clock.systemUTC(), Duration.ofSeconds(0, 123)); }
Example 10
Source File: TCKClock_Tick.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone_equal() { Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock changed = test.withZone(PARIS); assertEquals(test, changed); }
Example 11
Source File: TCKClock_Tick.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone_equal() { Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock changed = test.withZone(PARIS); assertEquals(test, changed); }
Example 12
Source File: TCKClock_Tick.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = IllegalArgumentException.class) public void test_tick_ClockDuration_subMilliNotDivisible_123ns() { Clock.tick(Clock.systemUTC(), Duration.ofSeconds(0, 123)); }
Example 13
Source File: TCKClock_Tick.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = IllegalArgumentException.class) public void test_tick_ClockDuration_negative1ns() { Clock.tick(Clock.systemUTC(), Duration.ofSeconds(0, -1)); }
Example 14
Source File: TCKClock_Tick.java From hottub with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 15
Source File: TCKClock_Tick.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void test_tick_ClockDuration_zeroDuration() { Clock underlying = Clock.system(PARIS); Clock test = Clock.tick(underlying, Duration.ZERO); assertSame(test, underlying); // spec says same }
Example 16
Source File: TCKClock_Tick.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = IllegalArgumentException.class) public void test_tick_ClockDuration_subMilliNotDivisible_999ns() { Clock.tick(Clock.systemUTC(), Duration.ofSeconds(0, 999)); }
Example 17
Source File: TCKClock_Tick.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void test_tick_ClockDuration_zeroDuration() { Clock underlying = Clock.system(PARIS); Clock test = Clock.tick(underlying, Duration.ZERO); assertSame(test, underlying); // spec says same }
Example 18
Source File: TCKClock_Tick.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void test_tick_ClockDuration_nullDuration() { Clock.tick(Clock.systemUTC(), null); }
Example 19
Source File: TCKClock_Tick.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = IllegalArgumentException.class) public void test_tick_ClockDuration_subMilliNotDivisible_123ns() { Clock.tick(Clock.systemUTC(), Duration.ofSeconds(0, 123)); }
Example 20
Source File: TCKClock_Tick.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void test_tick_ClockDuration_nullDuration() { Clock.tick(Clock.systemUTC(), null); }