Java Code Examples for java.time.ZonedDateTime#ofStrict()
The following examples show how to use
java.time.ZonedDateTime#ofStrict() .
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: TCKZonedDateTime.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Test public void test_withLaterOffsetAtOverlap_atOverlap() { ZonedDateTime base = ZonedDateTime.ofStrict(TEST_PARIS_OVERLAP_2008_10_26_02_30, OFFSET_0200, ZONE_PARIS); ZonedDateTime test = base.withLaterOffsetAtOverlap(); assertEquals(test.getOffset(), OFFSET_0100); // offset changed to later assertEquals(test.toLocalDateTime(), base.toLocalDateTime()); // date-time not changed }
Example 2
Source File: TCKZonedDateTime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test public void test_withLaterOffsetAtOverlap_atOverlap() { ZonedDateTime base = ZonedDateTime.ofStrict(TEST_PARIS_OVERLAP_2008_10_26_02_30, OFFSET_0200, ZONE_PARIS); ZonedDateTime test = base.withLaterOffsetAtOverlap(); assertEquals(test.getOffset(), OFFSET_0100); // offset changed to later assertEquals(test.toLocalDateTime(), base.toLocalDateTime()); // date-time not changed }
Example 3
Source File: TCKZonedDateTime.java From j2objc with Apache License 2.0 | 5 votes |
@Test public void test_withLaterOffsetAtOverlap_atOverlap() { ZonedDateTime base = ZonedDateTime.ofStrict(TEST_PARIS_OVERLAP_2008_10_26_02_30, OFFSET_0200, ZONE_PARIS); ZonedDateTime test = base.withLaterOffsetAtOverlap(); assertEquals(test.getOffset(), OFFSET_0100); // offset changed to later assertEquals(test.toLocalDateTime(), base.toLocalDateTime()); // date-time not changed }
Example 4
Source File: TCKZonedDateTime.java From j2objc with Apache License 2.0 | 5 votes |
@Test(expected=DateTimeException.class) public void factory_ofStrict_LDT_ZI_ZO_inGap() { try { ZonedDateTime.ofStrict(TEST_PARIS_GAP_2008_03_30_02_30, OFFSET_0100, ZONE_PARIS); } catch (DateTimeException ex) { assertEquals(ex.getMessage().contains(" gap"), true); throw ex; } }
Example 5
Source File: TCKZonedDateTime.java From hottub with GNU General Public License v2.0 | 5 votes |
@Test(expectedExceptions=DateTimeException.class) public void factory_ofStrict_LDT_ZI_ZO_inGap() { try { ZonedDateTime.ofStrict(TEST_PARIS_GAP_2008_03_30_02_30, OFFSET_0100, ZONE_PARIS); } catch (DateTimeException ex) { assertEquals(ex.getMessage().contains(" gap"), true); throw ex; } }
Example 6
Source File: TCKZonedDateTime.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void test_withLaterOffsetAtOverlap_atOverlap() { ZonedDateTime base = ZonedDateTime.ofStrict(TEST_PARIS_OVERLAP_2008_10_26_02_30, OFFSET_0200, ZONE_PARIS); ZonedDateTime test = base.withLaterOffsetAtOverlap(); assertEquals(test.getOffset(), OFFSET_0100); // offset changed to later assertEquals(test.toLocalDateTime(), base.toLocalDateTime()); // date-time not changed }
Example 7
Source File: TCKZonedDateTime.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test public void test_withLaterOffsetAtOverlap_atOverlap() { ZonedDateTime base = ZonedDateTime.ofStrict(TEST_PARIS_OVERLAP_2008_10_26_02_30, OFFSET_0200, ZONE_PARIS); ZonedDateTime test = base.withLaterOffsetAtOverlap(); assertEquals(test.getOffset(), OFFSET_0100); // offset changed to later assertEquals(test.toLocalDateTime(), base.toLocalDateTime()); // date-time not changed }
Example 8
Source File: TCKZonedDateTime.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test(expectedExceptions=DateTimeException.class) public void factory_ofStrict_LDT_ZI_ZO_invalidOffset() { try { ZonedDateTime.ofStrict(TEST_LOCAL_2008_06_30_11_30_59_500, OFFSET_0130, ZONE_PARIS); } catch (DateTimeException ex) { assertEquals(ex.getMessage().contains(" is not valid for "), true); throw ex; } }
Example 9
Source File: TCKZonedDateTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test public void factory_ofStrict_LDT_ZI_ZO() { LocalDateTime normal = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500); ZonedDateTime test = ZonedDateTime.ofStrict(normal, OFFSET_0200, ZONE_PARIS); check(test, 2008, 6, 30, 11, 30, 10, 500, OFFSET_0200, ZONE_PARIS); }
Example 10
Source File: TCKZonedDateTime.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void factory_ofStrict_LDT_ZI_ZO_nullZI() { ZonedDateTime.ofStrict(TEST_LOCAL_2008_06_30_11_30_59_500, OFFSET_0100, null); }
Example 11
Source File: TCKZonedDateTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static ZonedDateTime dateTime( int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneOffset offset, ZoneId zoneId) { return ZonedDateTime.ofStrict(LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond), offset, zoneId); }
Example 12
Source File: TCKZonedDateTime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Test public void test_withLaterOffsetAtOverlap_atOverlap_noChange() { ZonedDateTime base = ZonedDateTime.ofStrict(TEST_PARIS_OVERLAP_2008_10_26_02_30, OFFSET_0100, ZONE_PARIS); ZonedDateTime test = base.withLaterOffsetAtOverlap(); assertEquals(test, base); // not changed }
Example 13
Source File: TCKZonedDateTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static ZonedDateTime dateTime( int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneOffset offset, ZoneId zoneId) { return ZonedDateTime.ofStrict(LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond), offset, zoneId); }
Example 14
Source File: TCKZonedDateTime.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static ZonedDateTime dateTime( int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneOffset offset, ZoneId zoneId) { return ZonedDateTime.ofStrict(LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond), offset, zoneId); }
Example 15
Source File: TCKZonedDateTime.java From j2objc with Apache License 2.0 | 4 votes |
@Test(expected=NullPointerException.class) public void factory_ofStrict_LDT_ZI_ZO_nullLDT() { ZonedDateTime.ofStrict((LocalDateTime) null, OFFSET_0100, ZONE_PARIS); }
Example 16
Source File: TCKZonedDateTime.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Test public void test_withLaterOffsetAtOverlap_notAtOverlap() { ZonedDateTime base = ZonedDateTime.ofStrict(TEST_LOCAL_2008_06_30_11_30_59_500, OFFSET_0200, ZONE_PARIS); ZonedDateTime test = base.withLaterOffsetAtOverlap(); assertEquals(test, base); // not changed }
Example 17
Source File: TCKZonedDateTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Test public void test_withEarlierOffsetAtOverlap_atOverlap_noChange() { ZonedDateTime base = ZonedDateTime.ofStrict(TEST_PARIS_OVERLAP_2008_10_26_02_30, OFFSET_0200, ZONE_PARIS); ZonedDateTime test = base.withEarlierOffsetAtOverlap(); assertEquals(test, base); // not changed }
Example 18
Source File: TCKZonedDateTime.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void factory_ofStrict_LDT_ZI_ZO_nullZO() { ZonedDateTime.ofStrict(TEST_LOCAL_2008_06_30_11_30_59_500, null, ZONE_PARIS); }
Example 19
Source File: TCKZonedDateTime.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test public void factory_ofStrict_LDT_ZI_ZO() { LocalDateTime normal = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500); ZonedDateTime test = ZonedDateTime.ofStrict(normal, OFFSET_0200, ZONE_PARIS); check(test, 2008, 6, 30, 11, 30, 10, 500, OFFSET_0200, ZONE_PARIS); }
Example 20
Source File: TCKZonedDateTime.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static ZonedDateTime dateTime( int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneOffset offset, ZoneId zoneId) { return ZonedDateTime.ofStrict(LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond), offset, zoneId); }