1 /* 2 * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * This file is available under and governed by the GNU General Public 26 * License version 2 only, as published by the Free Software Foundation. 27 * However, the following notice accompanied the original version of this 28 * file: 29 * 30 * Copyright (c) 2012, Stephen Colebourne & Michael Nascimento Santos 31 * 32 * All rights reserved. 33 * 34 * Redistribution and use in source and binary forms, with or without 35 * modification, are permitted provided that the following conditions are met: 36 * 37 * * Redistributions of source code must retain the above copyright notice, 38 * this list of conditions and the following disclaimer. 39 * 40 * * Redistributions in binary form must reproduce the above copyright notice, 41 * this list of conditions and the following disclaimer in the documentation 42 * and/or other materials provided with the distribution. 43 * 44 * * Neither the name of JSR-310 nor the names of its contributors 45 * may be used to endorse or promote products derived from this software 46 * without specific prior written permission. 47 * 48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 49 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 50 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 51 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 52 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 53 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 54 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 55 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 56 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 57 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 58 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 59 */ 60 package tck.java.time.chrono; 61 62 import static org.testng.Assert.assertEquals; 63 import static org.testng.Assert.assertNotNull; 64 import static org.testng.Assert.assertSame; 65 import static org.testng.Assert.assertTrue; 66 67 import java.io.ByteArrayInputStream; 68 import java.io.ByteArrayOutputStream; 69 import java.io.ObjectInputStream; 70 import java.io.ObjectOutputStream; 71 import java.time.Clock; 72 import java.time.DateTimeException; 73 import java.time.LocalDate; 74 import java.time.LocalTime; 75 import java.time.OffsetDateTime; 76 import java.time.ZoneId; 77 import java.time.ZoneOffset; 78 import java.time.chrono.ChronoLocalDate; 79 import java.time.chrono.Chronology; 80 import java.time.chrono.Era; 81 import java.time.chrono.HijrahChronology; 82 import java.time.chrono.HijrahEra; 83 import java.time.chrono.IsoChronology; 84 import java.time.chrono.IsoEra; 85 import java.time.chrono.JapaneseChronology; 86 import java.time.chrono.JapaneseEra; 87 import java.time.chrono.MinguoChronology; 88 import java.time.chrono.MinguoEra; 89 import java.time.chrono.ThaiBuddhistChronology; 90 import java.time.chrono.ThaiBuddhistEra; 91 import java.time.format.TextStyle; 92 import java.time.temporal.ChronoField; 93 import java.util.Locale; 94 import java.util.Set; 95 96 import org.testng.annotations.DataProvider; 97 import org.testng.annotations.Test; 98 99 /** 100 * Test Chronology class. 101 */ 102 @Test 103 public class TCKChronology { 104 105 private static final ZoneOffset OFFSET_P0100 = ZoneOffset.ofHours(1); 106 private static final ZoneOffset OFFSET_M0100 = ZoneOffset.ofHours(-1); 107 108 private static final int YDIFF_MEIJI = 1867; 109 private static final int YDIFF_SHOWA = 1925; 110 private static final int YDIFF_HEISEI = 1988; 111 private static final int YDIFF_MINGUO = 1911; 112 private static final int YDIFF_THAIBUDDHIST = 543; 113 //----------------------------------------------------------------------- 114 // regular data factory for ID and calendarType of available calendars 115 //----------------------------------------------------------------------- 116 @DataProvider(name = "calendarNameAndType") data_of_calendars()117 Object[][] data_of_calendars() { 118 return new Object[][] { 119 {"Hijrah-umalqura", "islamic-umalqura"}, 120 {"ISO", "iso8601"}, 121 {"Japanese", "japanese"}, 122 {"Minguo", "roc"}, 123 {"ThaiBuddhist", "buddhist"}, 124 }; 125 } 126 127 @Test(dataProvider = "calendarNameAndType") test_getters(String chronoId, String calendarSystemType)128 public void test_getters(String chronoId, String calendarSystemType) { 129 Chronology chrono = Chronology.of(chronoId); 130 assertNotNull(chrono, "Required calendar not found by ID: " + chronoId); 131 assertEquals(chrono.getId(), chronoId); 132 assertEquals(chrono.getCalendarType(), calendarSystemType); 133 } 134 135 @Test(dataProvider = "calendarNameAndType") test_required_calendars(String chronoId, String calendarSystemType)136 public void test_required_calendars(String chronoId, String calendarSystemType) { 137 Chronology chrono = Chronology.of(chronoId); 138 assertNotNull(chrono, "Required calendar not found by ID: " + chronoId); 139 chrono = Chronology.of(calendarSystemType); 140 assertNotNull(chrono, "Required calendar not found by type: " + chronoId); 141 Set<Chronology> cals = Chronology.getAvailableChronologies(); 142 assertTrue(cals.contains(chrono), "Required calendar not found in set of available calendars"); 143 } 144 145 @Test test_calendar_list()146 public void test_calendar_list() { 147 Set<Chronology> chronos = Chronology.getAvailableChronologies(); 148 assertNotNull(chronos, "Required list of calendars must be non-null"); 149 for (Chronology chrono : chronos) { 150 Chronology lookup = Chronology.of(chrono.getId()); 151 assertNotNull(lookup, "Required calendar not found: " + chrono); 152 } 153 assertEquals(chronos.size() >= data_of_calendars().length, true, "Chronology.getAvailableChronologies().size = " + chronos.size() 154 + ", expected >= " + data_of_calendars().length); 155 } 156 157 //----------------------------------------------------------------------- 158 // getDisplayName() 159 //----------------------------------------------------------------------- 160 @DataProvider(name = "calendarDisplayName") data_of_calendarDisplayNames()161 Object[][] data_of_calendarDisplayNames() { 162 // Android-changed: Change expected values to CLDR values here. This test seems to be based 163 // on an old CLDR version (21) with some "invented" values (specifically Hijrah and ISO). 164 return new Object[][] { 165 {"Hijrah", "Islamic Calendar (Umm al-Qura)"}, 166 {"ISO", "ISO-8601 Calendar"}, 167 {"Japanese", "Japanese Calendar"}, 168 {"Minguo", "Minguo Calendar"}, 169 {"ThaiBuddhist", "Buddhist Calendar"}, 170 }; 171 } 172 173 @Test(dataProvider = "calendarDisplayName") test_getDisplayName(String chronoId, String calendarDisplayName)174 public void test_getDisplayName(String chronoId, String calendarDisplayName) { 175 Chronology chrono = Chronology.of(chronoId); 176 assertEquals(chrono.getDisplayName(TextStyle.FULL, Locale.ENGLISH), calendarDisplayName); 177 } 178 179 /** 180 * Compute the number of days from the Epoch and compute the date from the number of days. 181 */ 182 @Test(dataProvider = "calendarNameAndType") test_epoch(String name, String alias)183 public void test_epoch(String name, String alias) { 184 Chronology chrono = Chronology.of(name); // a chronology. In practice this is rarely hardcoded 185 ChronoLocalDate date1 = chrono.dateNow(); 186 long epoch1 = date1.getLong(ChronoField.EPOCH_DAY); 187 ChronoLocalDate date2 = date1.with(ChronoField.EPOCH_DAY, epoch1); 188 assertEquals(date1, date2, "Date from epoch day is not same date: " + date1 + " != " + date2); 189 long epoch2 = date1.getLong(ChronoField.EPOCH_DAY); 190 assertEquals(epoch1, epoch2, "Epoch day not the same: " + epoch1 + " != " + epoch2); 191 } 192 193 @Test(dataProvider = "calendarNameAndType") test_dateEpochDay(String name, String alias)194 public void test_dateEpochDay(String name, String alias) { 195 Chronology chrono = Chronology.of(name); 196 ChronoLocalDate date = chrono.dateNow(); 197 long epochDay = date.getLong(ChronoField.EPOCH_DAY); 198 ChronoLocalDate test = chrono.dateEpochDay(epochDay); 199 assertEquals(test, date); 200 } 201 202 //----------------------------------------------------------------------- 203 // locale based lookup 204 //----------------------------------------------------------------------- 205 @DataProvider(name = "calendarsystemtype") data_CalendarType()206 Object[][] data_CalendarType() { 207 return new Object[][] { 208 {HijrahChronology.INSTANCE, "islamic-umalqura"}, 209 {IsoChronology.INSTANCE, "iso8601"}, 210 {JapaneseChronology.INSTANCE, "japanese"}, 211 {MinguoChronology.INSTANCE, "roc"}, 212 {ThaiBuddhistChronology.INSTANCE, "buddhist"}, 213 }; 214 } 215 216 @Test(dataProvider = "calendarsystemtype") test_getCalendarType(Chronology chrono, String calendarType)217 public void test_getCalendarType(Chronology chrono, String calendarType) { 218 String type = calendarType; 219 assertEquals(chrono.getCalendarType(), type); 220 } 221 222 @Test(dataProvider = "calendarsystemtype") test_lookupLocale(Chronology chrono, String calendarType)223 public void test_lookupLocale(Chronology chrono, String calendarType) { 224 Locale.Builder builder = new Locale.Builder().setLanguage("en").setRegion("CA"); 225 builder.setUnicodeLocaleKeyword("ca", calendarType); 226 Locale locale = builder.build(); 227 assertEquals(Chronology.ofLocale(locale), chrono); 228 } 229 230 //----------------------------------------------------------------------- 231 // dateNow() 232 //----------------------------------------------------------------------- 233 @Test test_MinguoChronology_dateNow()234 public void test_MinguoChronology_dateNow() { 235 ZoneId zoneId_paris = ZoneId.of("Europe/Paris"); 236 Clock clock = Clock.system(zoneId_paris); 237 238 Chronology chrono = Chronology.of("Minguo"); 239 assertEquals(chrono.dateNow(), MinguoChronology.INSTANCE.dateNow()); 240 assertEquals(chrono.dateNow(zoneId_paris), MinguoChronology.INSTANCE.dateNow(zoneId_paris)); 241 assertEquals(chrono.dateNow(clock), MinguoChronology.INSTANCE.dateNow(clock)); 242 } 243 244 @Test test_IsoChronology_dateNow()245 public void test_IsoChronology_dateNow() { 246 ZoneId zoneId_paris = ZoneId.of("Europe/Paris"); 247 Clock clock = Clock.system(zoneId_paris); 248 249 Chronology chrono = Chronology.of("ISO"); 250 assertEquals(chrono.dateNow(), IsoChronology.INSTANCE.dateNow()); 251 assertEquals(chrono.dateNow(zoneId_paris), IsoChronology.INSTANCE.dateNow(zoneId_paris)); 252 assertEquals(chrono.dateNow(clock), IsoChronology.INSTANCE.dateNow(clock)); 253 } 254 255 @Test test_JapaneseChronology_dateNow()256 public void test_JapaneseChronology_dateNow() { 257 ZoneId zoneId_paris = ZoneId.of("Europe/Paris"); 258 Clock clock = Clock.system(zoneId_paris); 259 260 Chronology chrono = Chronology.of("Japanese"); 261 assertEquals(chrono.dateNow(), JapaneseChronology.INSTANCE.dateNow()); 262 assertEquals(chrono.dateNow(zoneId_paris), JapaneseChronology.INSTANCE.dateNow(zoneId_paris)); 263 assertEquals(chrono.dateNow(clock), JapaneseChronology.INSTANCE.dateNow(clock)); 264 } 265 266 @Test test_ThaiBuddhistChronology_dateNow()267 public void test_ThaiBuddhistChronology_dateNow() { 268 ZoneId zoneId_paris = ZoneId.of("Europe/Paris"); 269 Clock clock = Clock.system(zoneId_paris); 270 271 Chronology chrono = Chronology.of("ThaiBuddhist"); 272 assertEquals(chrono.dateNow(), ThaiBuddhistChronology.INSTANCE.dateNow()); 273 assertEquals(chrono.dateNow(zoneId_paris), ThaiBuddhistChronology.INSTANCE.dateNow(zoneId_paris)); 274 assertEquals(chrono.dateNow(clock), ThaiBuddhistChronology.INSTANCE.dateNow(clock)); 275 } 276 277 //----------------------------------------------------------------------- 278 // dateYearDay() and date() 279 //----------------------------------------------------------------------- 280 @Test test_HijrahChronology_dateYearDay()281 public void test_HijrahChronology_dateYearDay() { 282 Chronology chrono = Chronology.of("Hijrah"); 283 ChronoLocalDate date1 = chrono.dateYearDay(HijrahEra.AH, 1434, 178); 284 ChronoLocalDate date2 = chrono.date(HijrahEra.AH, 1434, 7, 1); 285 assertEquals(date1, HijrahChronology.INSTANCE.dateYearDay(HijrahEra.AH, 1434, 178)); 286 assertEquals(date2, HijrahChronology.INSTANCE.dateYearDay(HijrahEra.AH, 1434, 178)); 287 } 288 289 @Test test_MinguoChronology_dateYearDay()290 public void test_MinguoChronology_dateYearDay() { 291 Chronology chrono = Chronology.of("Minguo"); 292 ChronoLocalDate date1 = chrono.dateYearDay(MinguoEra.ROC, 5, 60); 293 ChronoLocalDate date2 = chrono.date(MinguoEra.ROC, 5, 2, 29); 294 assertEquals(date1, MinguoChronology.INSTANCE.dateYearDay(MinguoEra.ROC, 5, 60)); 295 assertEquals(date2, MinguoChronology.INSTANCE.dateYearDay(MinguoEra.ROC, 5, 60)); 296 } 297 298 @Test test_IsoChronology_dateYearDay()299 public void test_IsoChronology_dateYearDay() { 300 Chronology chrono = Chronology.of("ISO"); 301 ChronoLocalDate date1 = chrono.dateYearDay(IsoEra.CE, 5, 60); 302 ChronoLocalDate date2 = chrono.date(IsoEra.CE, 5, 3, 1); 303 assertEquals(date1, IsoChronology.INSTANCE.dateYearDay(IsoEra.CE, 5, 60)); 304 assertEquals(date2, IsoChronology.INSTANCE.dateYearDay(IsoEra.CE, 5, 60)); 305 } 306 307 @Test test_JapaneseChronology_dateYearDay()308 public void test_JapaneseChronology_dateYearDay() { 309 Chronology chrono = Chronology.of("Japanese"); 310 ChronoLocalDate date1 = chrono.dateYearDay(JapaneseEra.HEISEI, 8, 60); 311 ChronoLocalDate date2 = chrono.date(JapaneseEra.HEISEI, 8, 2, 29); 312 assertEquals(date1, JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.HEISEI, 8, 60)); 313 assertEquals(date2, JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.HEISEI, 8, 60)); 314 } 315 316 @Test test_ThaiBuddhistChronology_dateYearDay()317 public void test_ThaiBuddhistChronology_dateYearDay() { 318 Chronology chrono = Chronology.of("ThaiBuddhist"); 319 ChronoLocalDate date1 = chrono.dateYearDay(ThaiBuddhistEra.BE, 2459, 60); 320 ChronoLocalDate date2 = chrono.date(ThaiBuddhistEra.BE, 2459, 2, 29); 321 assertEquals(date1, ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BE, 2459, 60)); 322 assertEquals(date2, ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BE, 2459, 60)); 323 } 324 325 /** 326 * Test lookup by calendarType of each chronology. 327 * Verify that the calendar can be found by {@link java.time.chrono.Chronology#ofLocale}. 328 */ 329 @Test test_ofLocaleByType()330 public void test_ofLocaleByType() { 331 // Test that all available chronologies can be successfully found using ofLocale 332 Set<Chronology> chronos = Chronology.getAvailableChronologies(); 333 for (Chronology chrono : chronos) { 334 Locale.Builder builder = new Locale.Builder().setLanguage("en").setRegion("CA"); 335 builder.setUnicodeLocaleKeyword("ca", chrono.getCalendarType()); 336 Locale locale = builder.build(); 337 assertEquals(Chronology.ofLocale(locale), chrono, "Lookup by type"); 338 } 339 } 340 341 @Test(expectedExceptions = DateTimeException.class) test_lookupLocale()342 public void test_lookupLocale() { 343 Locale.Builder builder = new Locale.Builder().setLanguage("en").setRegion("CA"); 344 builder.setUnicodeLocaleKeyword("ca", "xxx"); 345 346 Locale locale = builder.build(); 347 Chronology.ofLocale(locale); 348 } 349 350 @Test(expectedExceptions = DateTimeException.class) test_noChrono()351 public void test_noChrono() { 352 Chronology chrono = Chronology.of("FooFoo"); 353 } 354 355 @DataProvider(name = "epochSecond_dataProvider") data_epochSecond()356 Object[][] data_epochSecond() { 357 return new Object[][] { 358 {JapaneseChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100}, 359 {JapaneseChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100}, 360 {JapaneseChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100}, 361 {HijrahChronology.INSTANCE, 1434, 9, 7, 1, 2, 2, OFFSET_P0100}, 362 {MinguoChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100}, 363 {MinguoChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100}, 364 {MinguoChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100}, 365 {ThaiBuddhistChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100}, 366 {ThaiBuddhistChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100}, 367 {ThaiBuddhistChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100}, 368 {IsoChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100}, 369 {IsoChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100}, 370 {IsoChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100}, 371 372 }; 373 } 374 375 @Test(dataProvider = "epochSecond_dataProvider") test_epochSecond(Chronology chrono, int y, int m, int d, int h, int min, int s, ZoneOffset offset)376 public void test_epochSecond(Chronology chrono, int y, int m, int d, int h, int min, int s, ZoneOffset offset) { 377 ChronoLocalDate chronoLd = chrono.date(y, m, d); 378 assertEquals(chrono.epochSecond(y, m, d, h, min, s, offset), 379 OffsetDateTime.of(LocalDate.from(chronoLd), LocalTime.of(h, min, s), offset) 380 .toEpochSecond()); 381 } 382 383 @DataProvider(name = "era_epochSecond_dataProvider") data_era_epochSecond()384 Object[][] data_era_epochSecond() { 385 return new Object[][] { 386 {JapaneseChronology.INSTANCE, JapaneseEra.MEIJI, 1873 - YDIFF_MEIJI, 9, 7, 1, 2, 2, OFFSET_P0100}, 387 {JapaneseChronology.INSTANCE, JapaneseEra.SHOWA, 1928 - YDIFF_SHOWA, 2, 28, 1, 2, 2, OFFSET_M0100}, 388 {JapaneseChronology.INSTANCE, JapaneseEra.HEISEI, 1989 - YDIFF_HEISEI, 1, 8, 1, 2, 2, OFFSET_P0100}, 389 {HijrahChronology.INSTANCE, HijrahEra.AH, 1434, 9, 7, 1, 2, 2, OFFSET_P0100}, 390 {MinguoChronology.INSTANCE, MinguoEra.BEFORE_ROC, 1873 - YDIFF_MINGUO, 9, 7, 1, 2, 2, OFFSET_P0100}, 391 {MinguoChronology.INSTANCE, MinguoEra.ROC, 1928 - YDIFF_MINGUO, 2, 28, 1, 2, 2, OFFSET_M0100}, 392 {MinguoChronology.INSTANCE, MinguoEra.ROC, 1989 - YDIFF_MINGUO, 1, 8, 1, 2, 2, OFFSET_P0100}, 393 {ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1873 + YDIFF_THAIBUDDHIST, 9, 7, 1, 2, 2, OFFSET_P0100}, 394 {ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1928 + YDIFF_THAIBUDDHIST, 2, 28, 1, 2, 2, OFFSET_M0100}, 395 {ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1989 + YDIFF_THAIBUDDHIST, 1, 8, 1, 2, 2, OFFSET_P0100}, 396 {IsoChronology.INSTANCE, IsoEra.CE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100}, 397 {IsoChronology.INSTANCE, IsoEra.CE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100}, 398 {IsoChronology.INSTANCE, IsoEra.CE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100}, 399 400 }; 401 } 402 403 @Test(dataProvider = "era_epochSecond_dataProvider") test_epochSecond(Chronology chrono, Era era, int y, int m, int d, int h, int min, int s, ZoneOffset offset)404 public void test_epochSecond(Chronology chrono, Era era, int y, int m, int d, int h, int min, int s, ZoneOffset offset) { 405 ChronoLocalDate chronoLd = chrono.date(era, y, m, d); 406 assertEquals(chrono.epochSecond(era, y, m, d, h, min, s, offset), 407 OffsetDateTime.of(LocalDate.from(chronoLd), LocalTime.of(h, min, s), offset) 408 .toEpochSecond()); 409 } 410 411 @DataProvider(name = "bad_epochSecond_dataProvider") bad_data_epochSecond()412 Object[][] bad_data_epochSecond() { 413 return new Object[][] { 414 {JapaneseChronology.INSTANCE, 1873, 13, 7, 1, 2, 2, OFFSET_P0100}, 415 {HijrahChronology.INSTANCE, 1434, 9, 32, 1, 2, 2, OFFSET_P0100}, 416 {MinguoChronology.INSTANCE, 1873, 9, 7, 31, 2, 2, OFFSET_P0100}, 417 {ThaiBuddhistChronology.INSTANCE, 1928, 2, 28, -1, 2, 2, OFFSET_M0100}, 418 {IsoChronology.INSTANCE, 1928, 2, 28, 1, 60, 2, OFFSET_M0100}, 419 {IsoChronology.INSTANCE, 1989, 1, 8, 1, 2, -2, OFFSET_P0100}, 420 421 }; 422 } 423 424 @Test(dataProvider = "bad_epochSecond_dataProvider", expectedExceptions = DateTimeException.class) test_bad_epochSecond(Chronology chrono, int y, int m, int d, int h, int min, int s, ZoneOffset offset)425 public void test_bad_epochSecond(Chronology chrono, int y, int m, int d, int h, int min, int s, ZoneOffset offset) { 426 chrono.epochSecond(y, m, d, h, min, s, offset); 427 } 428 429 } 430