< prev index next >

test/java/time/tck/java/time/TCKZonedDateTime.java

Print this page




 744         assertEquals(t.getNano(), n);
 745         assertEquals(t.getZone().getId(), zoneId);
 746     }
 747 
 748     @DataProvider(name="parseAdditional")
 749     Object[][] data_parseAdditional() {
 750         return new Object[][] {
 751                 {"2012-06-30T12:30:40Z[GMT]", 2012, 6, 30, 12, 30, 40, 0, "GMT"},
 752                 {"2012-06-30T12:30:40Z[UT]", 2012, 6, 30, 12, 30, 40, 0, "UT"},
 753                 {"2012-06-30T12:30:40Z[UTC]", 2012, 6, 30, 12, 30, 40, 0, "UTC"},
 754                 {"2012-06-30T12:30:40+01:00[Z]", 2012, 6, 30, 11, 30, 40, 0, "Z"},
 755                 {"2012-06-30T12:30:40+01:00[+01:00]", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
 756                 {"2012-06-30T12:30:40+01:00[GMT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "GMT+01:00"},
 757                 {"2012-06-30T12:30:40+01:00[UT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "UT+01:00"},
 758                 {"2012-06-30T12:30:40+01:00[UTC+01:00]", 2012, 6, 30, 12, 30, 40, 0, "UTC+01:00"},
 759                 {"2012-06-30T12:30:40-01:00[-01:00]", 2012, 6, 30, 12, 30, 40, 0, "-01:00"},
 760                 {"2012-06-30T12:30:40-01:00[GMT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "GMT-01:00"},
 761                 {"2012-06-30T12:30:40-01:00[UT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UT-01:00"},
 762                 {"2012-06-30T12:30:40-01:00[UTC-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UTC-01:00"},
 763                 {"2012-06-30T12:30:40+01:00[Europe/London]", 2012, 6, 30, 12, 30, 40, 0, "Europe/London"},

 764         };
 765     }
 766 
 767     @Test(dataProvider="parseAdditional")
 768     public void test_parseAdditional(String text, int y, int month, int d, int h, int m, int s, int n, String zoneId) {
 769         ZonedDateTime t = ZonedDateTime.parse(text);
 770         assertEquals(t.getYear(), y);
 771         assertEquals(t.getMonth().getValue(), month);
 772         assertEquals(t.getDayOfMonth(), d);
 773         assertEquals(t.getHour(), h);
 774         assertEquals(t.getMinute(), m);
 775         assertEquals(t.getSecond(), s);
 776         assertEquals(t.getNano(), n);
 777         assertEquals(t.getZone().getId(), zoneId);
 778     }
 779 
 780     @Test(expectedExceptions=DateTimeParseException.class)
 781     public void factory_parse_illegalValue() {
 782         ZonedDateTime.parse("2008-06-32T11:15+01:00[Europe/Paris]");
 783     }




 744         assertEquals(t.getNano(), n);
 745         assertEquals(t.getZone().getId(), zoneId);
 746     }
 747 
 748     @DataProvider(name="parseAdditional")
 749     Object[][] data_parseAdditional() {
 750         return new Object[][] {
 751                 {"2012-06-30T12:30:40Z[GMT]", 2012, 6, 30, 12, 30, 40, 0, "GMT"},
 752                 {"2012-06-30T12:30:40Z[UT]", 2012, 6, 30, 12, 30, 40, 0, "UT"},
 753                 {"2012-06-30T12:30:40Z[UTC]", 2012, 6, 30, 12, 30, 40, 0, "UTC"},
 754                 {"2012-06-30T12:30:40+01:00[Z]", 2012, 6, 30, 11, 30, 40, 0, "Z"},
 755                 {"2012-06-30T12:30:40+01:00[+01:00]", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
 756                 {"2012-06-30T12:30:40+01:00[GMT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "GMT+01:00"},
 757                 {"2012-06-30T12:30:40+01:00[UT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "UT+01:00"},
 758                 {"2012-06-30T12:30:40+01:00[UTC+01:00]", 2012, 6, 30, 12, 30, 40, 0, "UTC+01:00"},
 759                 {"2012-06-30T12:30:40-01:00[-01:00]", 2012, 6, 30, 12, 30, 40, 0, "-01:00"},
 760                 {"2012-06-30T12:30:40-01:00[GMT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "GMT-01:00"},
 761                 {"2012-06-30T12:30:40-01:00[UT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UT-01:00"},
 762                 {"2012-06-30T12:30:40-01:00[UTC-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UTC-01:00"},
 763                 {"2012-06-30T12:30:40+01:00[Europe/London]", 2012, 6, 30, 12, 30, 40, 0, "Europe/London"},
 764                 {"2012-06-30T12:30:40+01", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
 765         };
 766     }
 767 
 768     @Test(dataProvider="parseAdditional")
 769     public void test_parseAdditional(String text, int y, int month, int d, int h, int m, int s, int n, String zoneId) {
 770         ZonedDateTime t = ZonedDateTime.parse(text);
 771         assertEquals(t.getYear(), y);
 772         assertEquals(t.getMonth().getValue(), month);
 773         assertEquals(t.getDayOfMonth(), d);
 774         assertEquals(t.getHour(), h);
 775         assertEquals(t.getMinute(), m);
 776         assertEquals(t.getSecond(), s);
 777         assertEquals(t.getNano(), n);
 778         assertEquals(t.getZone().getId(), zoneId);
 779     }
 780 
 781     @Test(expectedExceptions=DateTimeParseException.class)
 782     public void factory_parse_illegalValue() {
 783         ZonedDateTime.parse("2008-06-32T11:15+01:00[Europe/Paris]");
 784     }


< prev index next >