Java Code Examples for java.time.ZoneOffset#ofHoursMinutes()
The following examples show how to use
java.time.ZoneOffset#ofHoursMinutes() .
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: Main.java From Java-11-Cookbook-Second-Edition with MIT License | 6 votes |
public static void main(String[] args) { var dateTime = ZonedDateTime.now(); System.out.println("Date Time using now(): " + dateTime); var indianTz = ZoneId.of("Asia/Kolkata"); var istDateTime = ZonedDateTime.now(indianTz); System.out.println("Date Time using ZoneId: " + istDateTime); var indianTzOffset = ZoneOffset.ofHoursMinutes(5, 30); istDateTime = ZonedDateTime.now(indianTzOffset); System.out.println("Date Time using ZoneOffset: " + istDateTime); ZonedDateTime dateTimeOf = ZonedDateTime.of(2018, 4, 22, 14, 30, 11, 33, indianTz); System.out.println("Date Time using of(): " + dateTimeOf); var localDateTime = dateTimeOf.toLocalDateTime(); System.out.println("LocalDateTime from ZonedDateTime: " + localDateTime); }
Example 2
Source File: TCKZoneOffset.java From hottub with GNU General Public License v2.0 | 5 votes |
@Test public void test_factory_int_hours_minutes() { for (int i = -17; i <= 17; i++) { for (int j = -59; j <= 59; j++) { if ((i < 0 && j <= 0) || (i > 0 && j >= 0) || i == 0) { ZoneOffset test = ZoneOffset.ofHoursMinutes(i, j); doTestOffset(test, i, j, 0); } } } ZoneOffset test1 = ZoneOffset.ofHoursMinutes(-18, 0); doTestOffset(test1, -18, 0, 0); ZoneOffset test2 = ZoneOffset.ofHoursMinutes(18, 0); doTestOffset(test2, 18, 0, 0); }
Example 3
Source File: ZoneOffSetDeserializerIT.java From bootique with Apache License 2.0 | 5 votes |
@Test public void testDeserializationWithTypeInfo01() throws Exception { ZoneOffset zoneOffset = ZoneOffset.ofHoursMinutes(17, 10); ObjectMapper mapper = createMapper(); mapper.addMixIn(TemporalAccessor.class, MockObjectConfiguration.class); TemporalAccessor value = mapper.readValue("[\"" + ZoneOffset.class.getName() + "\",\"+17:10\"]", TemporalAccessor.class); assertNotNull(value); assertTrue(value instanceof ZoneOffset, "The value should be a ZoneOffset."); assertEquals(zoneOffset, value); }
Example 4
Source File: TCKZoneOffset.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test public void test_factory_int_hours_minutes() { for (int i = -17; i <= 17; i++) { for (int j = -59; j <= 59; j++) { if ((i < 0 && j <= 0) || (i > 0 && j >= 0) || i == 0) { ZoneOffset test = ZoneOffset.ofHoursMinutes(i, j); doTestOffset(test, i, j, 0); } } } ZoneOffset test1 = ZoneOffset.ofHoursMinutes(-18, 0); doTestOffset(test1, -18, 0, 0); ZoneOffset test2 = ZoneOffset.ofHoursMinutes(18, 0); doTestOffset(test2, 18, 0, 0); }
Example 5
Source File: TCKZoneOffset.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_factory_int_hours_minutes() { for (int i = -17; i <= 17; i++) { for (int j = -59; j <= 59; j++) { if ((i < 0 && j <= 0) || (i > 0 && j >= 0) || i == 0) { ZoneOffset test = ZoneOffset.ofHoursMinutes(i, j); doTestOffset(test, i, j, 0); } } } ZoneOffset test1 = ZoneOffset.ofHoursMinutes(-18, 0); doTestOffset(test1, -18, 0, 0); ZoneOffset test2 = ZoneOffset.ofHoursMinutes(18, 0); doTestOffset(test2, 18, 0, 0); }
Example 6
Source File: ZoneOffsetVisitor.java From cava with Apache License 2.0 | 5 votes |
private static ZoneOffset toZoneOffset(int hours, int minutes, ParserRuleContext ctx, int offset) { try { return ZoneOffset.ofHoursMinutes(hours, (hours < 0) ? -minutes : minutes); } catch (DateTimeException e) { throw new TomlParseError("Invalid zone offset (valid range -18:00..+18:00)", new TomlPosition(ctx, offset), e); } }
Example 7
Source File: TCKZoneOffset.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=DateTimeException.class) public void test_factory_int_hours_minutes_tooSmall() { ZoneOffset.ofHoursMinutes(-19, 0); }
Example 8
Source File: TCKZoneIdPrinterParser.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@DataProvider(name="parseSuccess") Object[][] data_parseSuccess() { return new Object[][] { {"Z", 1, -1, ZoneId.of("Z")}, {"UTC", 3, -1, ZoneId.of("UTC")}, {"UT", 2, -1, ZoneId.of("UT")}, {"GMT", 3, -1, ZoneId.of("GMT")}, {"+00:00", 6, -1, ZoneOffset.UTC}, {"UTC+00:00", 9, -1, ZoneId.of("UTC")}, {"UT+00:00", 8, -1, ZoneId.of("UT")}, {"GMT+00:00", 9, -1, ZoneId.of("GMT")}, {"-00:00", 6, -1, ZoneOffset.UTC}, {"UTC-00:00", 9, -1, ZoneId.of("UTC")}, {"UT-00:00", 8, -1, ZoneId.of("UT")}, {"GMT-00:00", 9, -1, ZoneId.of("GMT")}, {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30)}, {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30")}, {"UT+02:30", 8, -1, ZoneId.of("UT+02:30")}, {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30")}, {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30)}, {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30")}, {"UT-02:30", 8, -1, ZoneId.of("UT-02:30")}, {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30")}, // fallback to UTC {"UTC-01:WW", 3, -1, ZoneId.of("UTC")}, {"UT-02:WW", 2, -1, ZoneId.of("UT")}, {"GMT-03:WW", 3, -1, ZoneId.of("GMT")}, {"Z0", 1, -1, ZoneOffset.UTC}, {"UTC1", 3, -1, ZoneId.of("UTC")}, // Z not parsed as zero {"UTCZ", 3, -1, ZoneId.of("UTC")}, {"UTZ", 2, -1, ZoneId.of("UT")}, {"GMTZ", 3, -1, ZoneId.of("GMT")}, // 0 not parsed {"UTC0", 3, -1, ZoneId.of("UTC")}, {"UT0", 2, -1, ZoneId.of("UT")}, // fail to parse {"", 0, 0, null}, {"A", 0, 0, null}, {"UZ", 0, 0, null}, {"GMA", 0, 0, null}, {"0", 0, 0, null}, {"+", 0, 0, null}, {"-", 0, 0, null}, // zone IDs {"Europe/London", 13, -1, ZoneId.of("Europe/London")}, {"America/New_York", 16, -1, ZoneId.of("America/New_York")}, {"America/Bogusville", 0, 0, null}, }; }
Example 9
Source File: TCKZoneOffset.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=DateTimeException.class) public void test_factory_int_hours_minutes_tooSmall() { ZoneOffset.ofHoursMinutes(-19, 0); }
Example 10
Source File: TestZoneOffsetPrinter.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@DataProvider(name="offsets") Object[][] provider_offsets() { return new Object[][] { {"+HH", "NO-OFFSET", ZoneOffset.UTC}, {"+HH", "+01", ZoneOffset.ofHours(1)}, {"+HH", "-01", ZoneOffset.ofHours(-1)}, {"+HHMM", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMM", "+0102", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HHMM", "-0102", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HH:MM", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM", "+01:02", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HH:MM", "-01:02", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HHMMss", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMss", "+0100", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+0102", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HHMMss", "+0159", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HHMMss", "+0200", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+1800", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "+010215", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HHMMss", "-0100", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-0200", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-1800", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMss", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMss", "+0100", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMss", "+015959", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HHMMss", "+0200", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+1800", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "-0100", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-0200", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-1800", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HH:MM:ss", "+01:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HH:MM:ss", "+02:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "+01:02:15", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HH:MM:ss", "-01:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:ss", "+01:59:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HH:MM:ss", "+02:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "-01:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMSS", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMSS", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMSS", "-010203", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, {"+HHMMSS", "+010200", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HHMMSS", "-010200", ZoneOffset.ofHoursMinutesSeconds(-1, -2, 0)}, {"+HH:MM:SS", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:SS", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:SS", "-01:02:03", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, {"+HH:MM:SS", "+01:02:00", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HH:MM:SS", "-01:02:00", ZoneOffset.ofHoursMinutesSeconds(-1, -2, 0)}, }; }
Example 11
Source File: TCKZoneIdPrinterParser.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@DataProvider(name="parseSuccess") Object[][] data_parseSuccess() { return new Object[][] { {"Z", 1, -1, ZoneId.of("Z")}, {"UTC", 3, -1, ZoneId.of("UTC")}, {"UT", 2, -1, ZoneId.of("UT")}, {"GMT", 3, -1, ZoneId.of("GMT")}, {"+00:00", 6, -1, ZoneOffset.UTC}, {"UTC+00:00", 9, -1, ZoneId.of("UTC")}, {"UT+00:00", 8, -1, ZoneId.of("UT")}, {"GMT+00:00", 9, -1, ZoneId.of("GMT")}, {"-00:00", 6, -1, ZoneOffset.UTC}, {"UTC-00:00", 9, -1, ZoneId.of("UTC")}, {"UT-00:00", 8, -1, ZoneId.of("UT")}, {"GMT-00:00", 9, -1, ZoneId.of("GMT")}, {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30)}, {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30")}, {"UT+02:30", 8, -1, ZoneId.of("UT+02:30")}, {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30")}, {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30)}, {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30")}, {"UT-02:30", 8, -1, ZoneId.of("UT-02:30")}, {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30")}, // fallback to UTC {"UTC-01:WW", 3, -1, ZoneId.of("UTC")}, {"UT-02:WW", 2, -1, ZoneId.of("UT")}, {"GMT-03:WW", 3, -1, ZoneId.of("GMT")}, {"Z0", 1, -1, ZoneOffset.UTC}, {"UTC1", 3, -1, ZoneId.of("UTC")}, // Z not parsed as zero {"UTCZ", 3, -1, ZoneId.of("UTC")}, {"UTZ", 2, -1, ZoneId.of("UT")}, {"GMTZ", 3, -1, ZoneId.of("GMT")}, // 0 not parsed {"UTC0", 3, -1, ZoneId.of("UTC")}, {"UT0", 2, -1, ZoneId.of("UT")}, // fail to parse {"", 0, 0, null}, {"A", 0, 0, null}, {"UZ", 0, 0, null}, {"GMA", 0, 0, null}, {"0", 0, 0, null}, {"+", 0, 0, null}, {"-", 0, 0, null}, // zone IDs {"Europe/London", 13, -1, ZoneId.of("Europe/London")}, {"America/New_York", 16, -1, ZoneId.of("America/New_York")}, {"America/Bogusville", 0, 0, null}, }; }
Example 12
Source File: TCKZoneIdPrinterParser.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@DataProvider(name="parseSuccess") Object[][] data_parseSuccess() { return new Object[][] { {"Z", 1, -1, ZoneId.of("Z")}, {"UTC", 3, -1, ZoneId.of("UTC")}, {"UT", 2, -1, ZoneId.of("UT")}, {"GMT", 3, -1, ZoneId.of("GMT")}, {"+00:00", 6, -1, ZoneOffset.UTC}, {"UTC+00:00", 9, -1, ZoneId.of("UTC")}, {"UT+00:00", 8, -1, ZoneId.of("UT")}, {"GMT+00:00", 9, -1, ZoneId.of("GMT")}, {"-00:00", 6, -1, ZoneOffset.UTC}, {"UTC-00:00", 9, -1, ZoneId.of("UTC")}, {"UT-00:00", 8, -1, ZoneId.of("UT")}, {"GMT-00:00", 9, -1, ZoneId.of("GMT")}, {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30)}, {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30")}, {"UT+02:30", 8, -1, ZoneId.of("UT+02:30")}, {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30")}, {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30)}, {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30")}, {"UT-02:30", 8, -1, ZoneId.of("UT-02:30")}, {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30")}, // fallback to UTC {"UTC-01:WW", 3, -1, ZoneId.of("UTC")}, {"UT-02:WW", 2, -1, ZoneId.of("UT")}, {"GMT-03:WW", 3, -1, ZoneId.of("GMT")}, {"Z0", 1, -1, ZoneOffset.UTC}, {"UTC1", 3, -1, ZoneId.of("UTC")}, // Z not parsed as zero {"UTCZ", 3, -1, ZoneId.of("UTC")}, {"UTZ", 2, -1, ZoneId.of("UT")}, {"GMTZ", 3, -1, ZoneId.of("GMT")}, // 0 not parsed {"UTC0", 3, -1, ZoneId.of("UTC")}, {"UT0", 2, -1, ZoneId.of("UT")}, // fail to parse {"", 0, 0, null}, {"A", 0, 0, null}, {"UZ", 0, 0, null}, {"GMA", 0, 0, null}, {"0", 0, 0, null}, {"+", 0, 0, null}, {"-", 0, 0, null}, // zone IDs {"Europe/London", 13, -1, ZoneId.of("Europe/London")}, {"America/New_York", 16, -1, ZoneId.of("America/New_York")}, {"America/Bogusville", 0, 0, null}, }; }
Example 13
Source File: TCKZoneIdPrinterParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@DataProvider(name="parseSuccess") Object[][] data_parseSuccess() { return new Object[][] { {"Z", 1, -1, ZoneId.of("Z"), true}, {"UTC", 3, -1, ZoneId.of("UTC"), false}, {"UT", 2, -1, ZoneId.of("UT"), false}, {"GMT", 3, -1, ZoneId.of("GMT"), false}, {"GMT0", 4, -1, ZoneId.of("GMT0"), false}, {"+00:00", 6, -1, ZoneOffset.UTC, true}, {"UTC+00:00", 9, -1, ZoneId.of("UTC"), false}, {"UT+00:00", 8, -1, ZoneId.of("UT"), false}, {"GMT+00:00", 9, -1, ZoneId.of("GMT"), false}, {"-00:00", 6, -1, ZoneOffset.UTC, true}, {"UTC-00:00", 9, -1, ZoneId.of("UTC"), false}, {"UT-00:00", 8, -1, ZoneId.of("UT"), false}, {"GMT-00:00", 9, -1, ZoneId.of("GMT"), false}, {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30), true}, {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30"), false}, {"UT+02:30", 8, -1, ZoneId.of("UT+02:30"), false}, {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30"), false}, {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30), true}, {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30"), false}, {"UT-02:30", 8, -1, ZoneId.of("UT-02:30"), false}, {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30"), false}, // fallback to UTC {"UTC-01:WW", 3, -1, ZoneId.of("UTC"), false}, {"UT-02:WW", 2, -1, ZoneId.of("UT"), false}, {"GMT-03:WW", 3, -1, ZoneId.of("GMT"), false}, {"Z0", 1, -1, ZoneOffset.UTC, true}, {"UTC1", 3, -1, ZoneId.of("UTC"), false}, // Z not parsed as zero {"UTCZ", 3, -1, ZoneId.of("UTC"), false}, {"UTZ", 2, -1, ZoneId.of("UT"), false}, {"GMTZ", 3, -1, ZoneId.of("GMT"), false}, // 0 not parsed {"UTC0", 3, -1, ZoneId.of("UTC"), false}, {"UT0", 2, -1, ZoneId.of("UT"), false}, // fail to parse {"", 0, 0, null, false}, {"A", 0, 0, null, false}, {"UZ", 0, 0, null, false}, {"GMA", 0, 0, null, false}, {"0", 0, 0, null, false}, {"+", 0, 0, null, false}, {"-", 0, 0, null, false}, // zone IDs {"Europe/London", 13, -1, ZoneId.of("Europe/London"), false}, {"America/New_York", 16, -1, ZoneId.of("America/New_York"), false}, {"America/Bogusville", 0, 0, null, false}, }; }
Example 14
Source File: TCKZoneOffset.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=DateTimeException.class) public void test_factory_int_hours_minutes_tooSmall() { ZoneOffset.ofHoursMinutes(-19, 0); }
Example 15
Source File: TestZoneOffsetPrinter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@DataProvider(name="offsets") Object[][] provider_offsets() { return new Object[][] { {"+HH", "NO-OFFSET", ZoneOffset.UTC}, {"+HH", "+01", ZoneOffset.ofHours(1)}, {"+HH", "-01", ZoneOffset.ofHours(-1)}, {"+HHMM", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMM", "+0102", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HHMM", "-0102", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HH:MM", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM", "+01:02", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HH:MM", "-01:02", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HHMMss", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMss", "+0100", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+0102", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HHMMss", "+0159", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HHMMss", "+0200", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+1800", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "+010215", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HHMMss", "-0100", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-0200", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-1800", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMss", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMss", "+0100", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMss", "+015959", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HHMMss", "+0200", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+1800", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "-0100", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-0200", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-1800", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HH:MM:ss", "+01:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HH:MM:ss", "+02:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "+01:02:15", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HH:MM:ss", "-01:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:ss", "+01:59:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HH:MM:ss", "+02:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "-01:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMSS", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMSS", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMSS", "-010203", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, {"+HHMMSS", "+010200", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HHMMSS", "-010200", ZoneOffset.ofHoursMinutesSeconds(-1, -2, 0)}, {"+HH:MM:SS", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:SS", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:SS", "-01:02:03", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, {"+HH:MM:SS", "+01:02:00", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HH:MM:SS", "-01:02:00", ZoneOffset.ofHoursMinutesSeconds(-1, -2, 0)}, }; }
Example 16
Source File: TestZoneOffsetParser.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@DataProvider(name="offsets") Object[][] provider_offsets() { return new Object[][] { {"+HH", "+00", ZoneOffset.UTC}, {"+HH", "-00", ZoneOffset.UTC}, {"+HH", "+01", ZoneOffset.ofHours(1)}, {"+HH", "-01", ZoneOffset.ofHours(-1)}, {"+HHMM", "+0000", ZoneOffset.UTC}, {"+HHMM", "-0000", ZoneOffset.UTC}, {"+HHMM", "+0102", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HHMM", "-0102", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HH:MM", "+00:00", ZoneOffset.UTC}, {"+HH:MM", "-00:00", ZoneOffset.UTC}, {"+HH:MM", "+01:02", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HH:MM", "-01:02", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HHMMss", "+0000", ZoneOffset.UTC}, {"+HHMMss", "-0000", ZoneOffset.UTC}, {"+HHMMss", "+0100", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+0159", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HHMMss", "+0200", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+1800", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "+010215", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HHMMss", "-0100", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-0200", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-1800", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMss", "+000000", ZoneOffset.UTC}, {"+HHMMss", "-000000", ZoneOffset.UTC}, {"+HHMMss", "+010000", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMss", "+015959", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HHMMss", "+020000", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+180000", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "-010000", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-020000", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-180000", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "+00:00", ZoneOffset.UTC}, {"+HH:MM:ss", "-00:00", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HH:MM:ss", "+01:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HH:MM:ss", "+02:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "+01:02:15", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HH:MM:ss", "-01:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "+00:00:00", ZoneOffset.UTC}, {"+HH:MM:ss", "-00:00:00", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:ss", "+01:59:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HH:MM:ss", "+02:00:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "-01:00:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMSS", "+000000", ZoneOffset.UTC}, {"+HHMMSS", "-000000", ZoneOffset.UTC}, {"+HHMMSS", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMSS", "-010203", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, {"+HH:MM:SS", "+00:00:00", ZoneOffset.UTC}, {"+HH:MM:SS", "-00:00:00", ZoneOffset.UTC}, {"+HH:MM:SS", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:SS", "-01:02:03", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, }; }
Example 17
Source File: TCKZoneOffset.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=DateTimeException.class) public void test_factory_int_hours_minutes_tooBig() { ZoneOffset.ofHoursMinutes(19, 0); }
Example 18
Source File: TestZoneOffsetPrinter.java From j2objc with Apache License 2.0 | 4 votes |
@DataProvider public static Object[][] provider_offsets() { return new Object[][] { {"+HH", "NO-OFFSET", ZoneOffset.UTC}, {"+HH", "+01", ZoneOffset.ofHours(1)}, {"+HH", "-01", ZoneOffset.ofHours(-1)}, {"+HHMM", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMM", "+0102", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HHMM", "-0102", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HH:MM", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM", "+01:02", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HH:MM", "-01:02", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HHMMss", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMss", "+0100", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+0102", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HHMMss", "+0159", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HHMMss", "+0200", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+1800", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "+010215", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HHMMss", "-0100", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-0200", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-1800", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMss", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMss", "+0100", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMss", "+015959", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HHMMss", "+0200", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+1800", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "-0100", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-0200", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-1800", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HH:MM:ss", "+01:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HH:MM:ss", "+02:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "+01:02:15", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HH:MM:ss", "-01:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:ss", "+01:59:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HH:MM:ss", "+02:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "-01:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMSS", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMSS", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMSS", "-010203", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, {"+HHMMSS", "+010200", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HHMMSS", "-010200", ZoneOffset.ofHoursMinutesSeconds(-1, -2, 0)}, {"+HH:MM:SS", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:SS", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:SS", "-01:02:03", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, {"+HH:MM:SS", "+01:02:00", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HH:MM:SS", "-01:02:00", ZoneOffset.ofHoursMinutesSeconds(-1, -2, 0)}, }; }
Example 19
Source File: TestZoneOffsetPrinter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@DataProvider(name="offsets") Object[][] provider_offsets() { return new Object[][] { {"+HH", "NO-OFFSET", ZoneOffset.UTC}, {"+HH", "+01", ZoneOffset.ofHours(1)}, {"+HH", "-01", ZoneOffset.ofHours(-1)}, {"+HHMM", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMM", "+0102", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HHMM", "-0102", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HH:MM", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM", "+01:02", ZoneOffset.ofHoursMinutes(1, 2)}, {"+HH:MM", "-01:02", ZoneOffset.ofHoursMinutes(-1, -2)}, {"+HHMMss", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMss", "+0100", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+0102", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HHMMss", "+0159", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HHMMss", "+0200", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+1800", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "+010215", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HHMMss", "-0100", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-0200", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-1800", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMss", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMss", "+0100", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HHMMss", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMss", "+015959", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HHMMss", "+0200", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HHMMss", "+1800", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HHMMss", "-0100", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HHMMss", "-0200", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HHMMss", "-1800", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HH:MM:ss", "+01:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 0)}, {"+HH:MM:ss", "+02:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "+01:02:15", ZoneOffset.ofHoursMinutesSeconds(1, 2, 15)}, {"+HH:MM:ss", "-01:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HH:MM:ss", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:ss", "+01:00", ZoneOffset.ofHoursMinutesSeconds(1, 0, 0)}, {"+HH:MM:ss", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:ss", "+01:59:59", ZoneOffset.ofHoursMinutesSeconds(1, 59, 59)}, {"+HH:MM:ss", "+02:00", ZoneOffset.ofHoursMinutesSeconds(2, 0, 0)}, {"+HH:MM:ss", "+18:00", ZoneOffset.ofHoursMinutesSeconds(18, 0, 0)}, {"+HH:MM:ss", "-01:00", ZoneOffset.ofHoursMinutesSeconds(-1, 0, 0)}, {"+HH:MM:ss", "-02:00", ZoneOffset.ofHoursMinutesSeconds(-2, 0, 0)}, {"+HH:MM:ss", "-18:00", ZoneOffset.ofHoursMinutesSeconds(-18, 0, 0)}, {"+HHMMSS", "NO-OFFSET", ZoneOffset.UTC}, {"+HHMMSS", "+010203", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HHMMSS", "-010203", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, {"+HHMMSS", "+010200", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HHMMSS", "-010200", ZoneOffset.ofHoursMinutesSeconds(-1, -2, 0)}, {"+HH:MM:SS", "NO-OFFSET", ZoneOffset.UTC}, {"+HH:MM:SS", "+01:02:03", ZoneOffset.ofHoursMinutesSeconds(1, 2, 3)}, {"+HH:MM:SS", "-01:02:03", ZoneOffset.ofHoursMinutesSeconds(-1, -2, -3)}, {"+HH:MM:SS", "+01:02:00", ZoneOffset.ofHoursMinutesSeconds(1, 2, 0)}, {"+HH:MM:SS", "-01:02:00", ZoneOffset.ofHoursMinutesSeconds(-1, -2, 0)}, }; }
Example 20
Source File: TCKZoneIdPrinterParser.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@DataProvider(name="parseSuccess") Object[][] data_parseSuccess() { return new Object[][] { {"Z", 1, -1, ZoneId.of("Z")}, {"UTC", 3, -1, ZoneId.of("UTC")}, {"UT", 2, -1, ZoneId.of("UT")}, {"GMT", 3, -1, ZoneId.of("GMT")}, {"+00:00", 6, -1, ZoneOffset.UTC}, {"UTC+00:00", 9, -1, ZoneId.of("UTC")}, {"UT+00:00", 8, -1, ZoneId.of("UT")}, {"GMT+00:00", 9, -1, ZoneId.of("GMT")}, {"-00:00", 6, -1, ZoneOffset.UTC}, {"UTC-00:00", 9, -1, ZoneId.of("UTC")}, {"UT-00:00", 8, -1, ZoneId.of("UT")}, {"GMT-00:00", 9, -1, ZoneId.of("GMT")}, {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30)}, {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30")}, {"UT+02:30", 8, -1, ZoneId.of("UT+02:30")}, {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30")}, {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30)}, {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30")}, {"UT-02:30", 8, -1, ZoneId.of("UT-02:30")}, {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30")}, // fallback to UTC {"UTC-01:WW", 3, -1, ZoneId.of("UTC")}, {"UT-02:WW", 2, -1, ZoneId.of("UT")}, {"GMT-03:WW", 3, -1, ZoneId.of("GMT")}, {"Z0", 1, -1, ZoneOffset.UTC}, {"UTC1", 3, -1, ZoneId.of("UTC")}, // Z not parsed as zero {"UTCZ", 3, -1, ZoneId.of("UTC")}, {"UTZ", 2, -1, ZoneId.of("UT")}, {"GMTZ", 3, -1, ZoneId.of("GMT")}, // 0 not parsed {"UTC0", 3, -1, ZoneId.of("UTC")}, {"UT0", 2, -1, ZoneId.of("UT")}, // fail to parse {"", 0, 0, null}, {"A", 0, 0, null}, {"UZ", 0, 0, null}, {"GMA", 0, 0, null}, {"0", 0, 0, null}, {"+", 0, 0, null}, {"-", 0, 0, null}, // zone IDs {"Europe/London", 13, -1, ZoneId.of("Europe/London")}, {"America/New_York", 16, -1, ZoneId.of("America/New_York")}, {"America/Bogusville", 0, 0, null}, }; }