Java Code Examples for java.time.zone.ZoneRules#nextTransition()
The following examples show how to use
java.time.zone.ZoneRules#nextTransition() .
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: TCKZoneRules.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 2
Source File: TCKZoneRules.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1879-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1879, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1879, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1879, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1879, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1879, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1879, 7, 4, 1, 0, 0)); }
Example 3
Source File: TCKZoneRules.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 4
Source File: TCKZoneRules.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1879-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1879, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1879, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1879, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1879, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1879, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1879, 7, 4, 1, 0, 0)); }
Example 5
Source File: TCKZoneRules.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 6
Source File: TCKZoneRules.java From hottub with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1879-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1879, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1879, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1879, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1879, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1879, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1879, 7, 4, 1, 0, 0)); }
Example 7
Source File: TCKZoneRules.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1879-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1879, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1879, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1879, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1879, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1879, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1879, 7, 4, 1, 0, 0)); }
Example 8
Source File: TCKZoneRules.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1879-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1879, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1879, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1879, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1879, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1879, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1879, 7, 4, 1, 0, 0)); }
Example 9
Source File: TCKZoneRules.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 10
Source File: TCKZoneRules.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 11
Source File: TCKZoneRules.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 12
Source File: TCKZoneRules.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1892-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1892, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1892, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1892, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1892, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1892, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1892, 7, 4, 1, 0, 0)); }
Example 13
Source File: TCKZoneRules.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 14
Source File: TCKZoneRules.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1892-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1892, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1892, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1892, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1892, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1892, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1892, 7, 4, 1, 0, 0)); }
Example 15
Source File: TCKZoneRules.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1892-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1892, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1892, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1892, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1892, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1892, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1892, 7, 4, 1, 0, 0)); }
Example 16
Source File: TCKZoneRules.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1879-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1879, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1879, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1879, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1879, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1879, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1879, 7, 4, 1, 0, 0)); }
Example 17
Source File: TCKZoneRules.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 18
Source File: TCKZoneRules.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 19
Source File: TCKZoneRules.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() { // transition occurred at 2011-12-30T00:00-10:00 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0)); assertEquals(trans.isGap(), true); assertEquals(trans.isOverlap(), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false); assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false); assertEquals(trans.getDuration(), Duration.ofHours(24)); assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14))); ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0)); }
Example 20
Source File: TCKZoneRules.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() { // transition occurred at 1892-07-04T00:00+12:33:04 ZoneRules test = pacificApia(); Instant instantBefore = LocalDate.of(1892, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant(); ZoneOffsetTransition trans = test.nextTransition(instantBefore); assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1892, 7, 5, 0, 0)); assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1892, 7, 4, 0, 0)); assertEquals(trans.isGap(), false); assertEquals(trans.isOverlap(), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true); assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true); assertEquals(trans.getDuration(), Duration.ofHours(-24)); assertEquals(trans.getInstant(), LocalDateTime.of(1892, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56))); ZonedDateTime zdt = ZonedDateTime.of(1892, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia")); assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1892, 7, 4, 1, 0, 0)); }