Java Code Examples for java.time.Clock#withZone()
The following examples show how to use
java.time.Clock#withZone() .
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: ClockUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void givenClock_usingWithZone_retrievesInstant() { ZoneId zoneSingapore = ZoneId.of("Asia/Singapore"); Clock clockSingapore = Clock.system(zoneSingapore); assertEquals(clockSingapore.instant().equals(null), false); LOGGER.debug("clockSingapore instant : " + clockSingapore.instant()); ZoneId zoneCalcutta = ZoneId.of("Asia/Calcutta"); Clock clockCalcutta = clockSingapore.withZone(zoneCalcutta); assertEquals(clockCalcutta.instant().equals(null), false); LOGGER.debug("clockCalcutta instant : " + clockSingapore.instant()); }
Example 2
Source File: TCKClock_System.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void test_withZone_equal() { Clock test = Clock.system(PARIS); Clock changed = test.withZone(PARIS); assertEquals(changed.getZone(), PARIS); }
Example 3
Source File: TCKClock_System.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone_equal() { Clock test = Clock.system(PARIS); Clock changed = test.withZone(PARIS); assertEquals(changed.getZone(), PARIS); }
Example 4
Source File: TCKClock_Fixed.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.fixed(INSTANT, PARIS); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 5
Source File: TestClock_Offset.java From openjdk-jdk8u-backup 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 6
Source File: TCKClock_System.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.system(PARIS); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 7
Source File: TCKClock_Tick.java From openjdk-8 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 8
Source File: TCKClock_System.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.system(PARIS); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 9
Source File: TCKClock_Fixed.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.fixed(INSTANT, PARIS); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 10
Source File: TCKClock_Offset.java From hottub with GNU General Public License v2.0 | 4 votes |
public void test_withZone_equal() { Clock test = Clock.offset(Clock.system(PARIS), OFFSET); Clock changed = test.withZone(PARIS); assertEquals(test, changed); }
Example 11
Source File: TCKClock_Fixed.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.fixed(INSTANT, PARIS); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 12
Source File: TestClock_Tick.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone_same() { Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock changed = test.withZone(PARIS); assertSame(test, changed); }
Example 13
Source File: TestClock_System.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void test_withZone_same() { Clock test = Clock.system(PARIS); Clock changed = test.withZone(PARIS); assertSame(test, changed); }
Example 14
Source File: TestClock_System.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void test_withZone_same() { Clock test = Clock.system(PARIS); Clock changed = test.withZone(PARIS); assertSame(test, changed); }
Example 15
Source File: TestClock_Fixed.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void test_withZone_same() { Clock test = Clock.fixed(INSTANT, PARIS); Clock changed = test.withZone(PARIS); assertSame(test, changed); }
Example 16
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 17
Source File: TCKClock_System.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone() { Clock test = Clock.system(PARIS); Clock changed = test.withZone(MOSCOW); assertEquals(test.getZone(), PARIS); assertEquals(changed.getZone(), MOSCOW); }
Example 18
Source File: TCKClock_Offset.java From dragonwell8_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 19
Source File: TestClock_Tick.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void test_withZone_same() { Clock test = Clock.tick(Clock.system(PARIS), Duration.ofMillis(500)); Clock changed = test.withZone(PARIS); assertSame(test, changed); }
Example 20
Source File: TestClock_System.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_withZone_same() { Clock test = Clock.system(PARIS); Clock changed = test.withZone(PARIS); assertSame(test, changed); }