java.time.chrono.ThaiBuddhistChronology Java Examples
The following examples show how to use
java.time.chrono.ThaiBuddhistChronology.
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: TestThaiBuddhistChronoImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="RangeVersusCalendar") public void test_ThaiBuddhistChrono_vsCalendar(LocalDate isoStartDate, LocalDate isoEndDate) { Locale locale = Locale.forLanguageTag("th-TH--u-ca-buddhist"); assertEquals(locale.toString(), "th_TH", "Unexpected locale"); Calendar cal = java.util.Calendar.getInstance(locale); assertEquals(cal.getCalendarType(), "buddhist", "Unexpected calendar type"); ThaiBuddhistDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(isoStartDate); cal.setTimeZone(TimeZone.getTimeZone("GMT+00")); cal.set(Calendar.YEAR, thaiDate.get(ChronoField.YEAR)); cal.set(Calendar.MONTH, thaiDate.get(ChronoField.MONTH_OF_YEAR) - 1); cal.set(Calendar.DAY_OF_MONTH, thaiDate.get(ChronoField.DAY_OF_MONTH)); while (thaiDate.isBefore(isoEndDate)) { assertEquals(thaiDate.get(ChronoField.DAY_OF_MONTH), cal.get(Calendar.DAY_OF_MONTH), "Day mismatch in " + thaiDate + "; cal: " + cal); assertEquals(thaiDate.get(ChronoField.MONTH_OF_YEAR), cal.get(Calendar.MONTH) + 1, "Month mismatch in " + thaiDate); assertEquals(thaiDate.get(ChronoField.YEAR_OF_ERA), cal.get(Calendar.YEAR), "Year mismatch in " + thaiDate); thaiDate = thaiDate.plus(1, ChronoUnit.DAYS); cal.add(Calendar.DAY_OF_MONTH, 1); } }
Example #2
Source File: TCKThaiBuddhistChronology.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "resolve_ymaa") public void test_resolve_ymaa_smart(int y, int m, int w, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m); fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w); fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d); if (smart) { ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); } else { try { ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART); fail("Should have failed"); } catch (DateTimeException ex) { // expected } } }
Example #3
Source File: TCKThaiBuddhistChronology.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "resolve_yd") public void test_resolve_yd_strict(int y, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d); if (strict) { ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); } else { try { ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT); fail("Should have failed"); } catch (DateTimeException ex) { // expected } } }
Example #4
Source File: TCKThaiBuddhistChronology.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "resolve_yd") public void test_resolve_yd_strict(int y, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d); if (strict) { ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); } else { try { ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT); fail("Should have failed"); } catch (DateTimeException ex) { // expected } } }
Example #5
Source File: TCKThaiBuddhistChronology.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "resolve_yd") public void test_resolve_yd_smart(int y, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d); if (smart) { ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); } else { try { ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART); fail("Should have failed"); } catch (DateTimeException ex) { // expected } } }
Example #6
Source File: TCKThaiBuddhistChronology.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "resolve_ymaa") public void test_resolve_ymaa_strict(int y, int m, int w, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m); fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w); fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d); if (strict) { ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); } else { try { ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT); fail("Should have failed"); } catch (DateTimeException ex) { // expected } } }
Example #7
Source File: TCKThaiBuddhistChronology.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "resolve_yearOfEra") public void test_resolve_yearOfEra(ResolverStyle style, Integer e, Integer yoe, Integer y, ChronoField field, Integer expected) { Map<TemporalField, Long> fieldValues = new HashMap<>(); if (e != null) { fieldValues.put(ChronoField.ERA, (long) e); } if (yoe != null) { fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe); } if (y != null) { fieldValues.put(ChronoField.YEAR, (long) y); } if (field != null) { ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, style); assertEquals(date, null); assertEquals(fieldValues.get(field), (Long) expected.longValue()); assertEquals(fieldValues.size(), 1); } else { try { ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, style); fail("Should have failed"); } catch (DateTimeException ex) { // expected } } }
Example #8
Source File: TCKThaiBuddhistChronology.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "resolve_ymaa") public void test_resolve_ymaa_smart(int y, int m, int w, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m); fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w); fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d); if (smart) { ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); } else { try { ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART); fail("Should have failed"); } catch (DateTimeException ex) { // expected } } }
Example #9
Source File: TCKThaiBuddhistChronology.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "resolve_yearOfEra") public void test_resolve_yearOfEra(ResolverStyle style, Integer e, Integer yoe, Integer y, ChronoField field, Integer expected) { Map<TemporalField, Long> fieldValues = new HashMap<>(); if (e != null) { fieldValues.put(ChronoField.ERA, (long) e); } if (yoe != null) { fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe); } if (y != null) { fieldValues.put(ChronoField.YEAR, (long) y); } if (field != null) { ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, style); assertEquals(date, null); assertEquals(fieldValues.get(field), (Long) expected.longValue()); assertEquals(fieldValues.size(), 1); } else { try { ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, style); fail("Should have failed"); } catch (DateTimeException ex) { // expected } } }
Example #10
Source File: TCKThaiBuddhistChronology.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "resolve_ymd") public void test_resolve_ymd_strict(int y, int m, int d, ThaiBuddhistDate expected, Object smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m); fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d); if (strict) { ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); } else { try { ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT); fail("Should have failed"); } catch (DateTimeException ex) { // expected } } }
Example #11
Source File: TestChronoLocalDate.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod() { Chronology chrono = ThaiBuddhistChronology.INSTANCE; ChronoLocalDate date = chrono.dateNow(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); date = processClassWeird(ThaiBuddhistDate.class); }
Example #12
Source File: TCKChronoPeriod.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="calendars", expectedExceptions=DateTimeException.class) public void test_addTo_wrongChrono(Chronology chrono) { ChronoPeriod period = chrono.period(1, 2, 3); ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1); ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1); // one of these two will fail period.addTo(isoDate); period.addTo(thaiDate); }
Example #13
Source File: TCKThaiBuddhistChronology.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="samples") Object[][] data_samples() { return new Object[][] { {ThaiBuddhistChronology.INSTANCE.date(1 + YDIFF, 1, 1), LocalDate.of(1, 1, 1)}, {ThaiBuddhistChronology.INSTANCE.date(1 + YDIFF, 1, 2), LocalDate.of(1, 1, 2)}, {ThaiBuddhistChronology.INSTANCE.date(1 + YDIFF, 1, 3), LocalDate.of(1, 1, 3)}, {ThaiBuddhistChronology.INSTANCE.date(2 + YDIFF, 1, 1), LocalDate.of(2, 1, 1)}, {ThaiBuddhistChronology.INSTANCE.date(3 + YDIFF, 1, 1), LocalDate.of(3, 1, 1)}, {ThaiBuddhistChronology.INSTANCE.date(3 + YDIFF, 12, 6), LocalDate.of(3, 12, 6)}, {ThaiBuddhistChronology.INSTANCE.date(4 + YDIFF, 1, 1), LocalDate.of(4, 1, 1)}, {ThaiBuddhistChronology.INSTANCE.date(4 + YDIFF, 7, 3), LocalDate.of(4, 7, 3)}, {ThaiBuddhistChronology.INSTANCE.date(4 + YDIFF, 7, 4), LocalDate.of(4, 7, 4)}, {ThaiBuddhistChronology.INSTANCE.date(5 + YDIFF, 1, 1), LocalDate.of(5, 1, 1)}, {ThaiBuddhistChronology.INSTANCE.date(1662 + YDIFF, 3, 3), LocalDate.of(1662, 3, 3)}, {ThaiBuddhistChronology.INSTANCE.date(1728 + YDIFF, 10, 28), LocalDate.of(1728, 10, 28)}, {ThaiBuddhistChronology.INSTANCE.date(1728 + YDIFF, 10, 29), LocalDate.of(1728, 10, 29)}, {ThaiBuddhistChronology.INSTANCE.date(2555, 8, 29), LocalDate.of(2012, 8, 29)}, {ThaiBuddhistChronology.INSTANCE.dateYearDay(4 + YDIFF, 60), LocalDate.of(4, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.dateYearDay(400 + YDIFF, 60), LocalDate.of(400, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.dateYearDay(2000 + YDIFF, 60), LocalDate.of(2000, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BE, 1916 + YDIFF, 60), LocalDate.of(1916, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BEFORE_BE, -1907 - YDIFF, 60), LocalDate.of(1908, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BE, 2000 + YDIFF, 60), LocalDate.of(2000, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BE, 2400 + YDIFF, 60), LocalDate.of(2400, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.date(ThaiBuddhistEra.BE, 1916 + YDIFF, 2, 29 ), LocalDate.of(1916, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.date(ThaiBuddhistEra.BEFORE_BE, -1907 - YDIFF, 2, 29), LocalDate.of(1908, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.date(ThaiBuddhistEra.BE, 2000 + YDIFF, 2, 29), LocalDate.of(2000, 2, 29)}, {ThaiBuddhistChronology.INSTANCE.date(ThaiBuddhistEra.BE, 2400 + YDIFF, 2, 29), LocalDate.of(2400, 2, 29)}, }; }
Example #14
Source File: TCKChronoPeriod.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="calendars", expectedExceptions=DateTimeException.class) public void test_addTo_wrongChrono(Chronology chrono) { ChronoPeriod period = chrono.period(1, 2, 3); ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1); ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1); // one of these two will fail period.addTo(isoDate); period.addTo(thaiDate); }
Example #15
Source File: TCKChronoPeriod.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="calendars", expectedExceptions=DateTimeException.class) public void test_minus_wrongChrono(Chronology chrono) { ChronoPeriod period = chrono.period(1, 2, 3); ChronoPeriod isoPeriod = Period.of(2, 3, 4); ChronoPeriod thaiPeriod = ThaiBuddhistChronology.INSTANCE.period(2, 3, 4); // one of these two will fail period.minus(isoPeriod); period.minus(thaiPeriod); }
Example #16
Source File: TCKChronology.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "bad_epochSecond_dataProvider") Object[][] bad_data_epochSecond() { return new Object[][] { {JapaneseChronology.INSTANCE, 1873, 13, 7, 1, 2, 2, OFFSET_P0100}, {HijrahChronology.INSTANCE, 1434, 9, 32, 1, 2, 2, OFFSET_P0100}, {MinguoChronology.INSTANCE, 1873, 9, 7, 31, 2, 2, OFFSET_P0100}, {ThaiBuddhistChronology.INSTANCE, 1928, 2, 28, -1, 2, 2, OFFSET_M0100}, {IsoChronology.INSTANCE, 1928, 2, 28, 1, 60, 2, OFFSET_M0100}, {IsoChronology.INSTANCE, 1989, 1, 8, 1, 2, -2, OFFSET_P0100}, }; }
Example #17
Source File: TCKChronoZonedDateTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "calendars") Chronology[][] data_of_calendars() { return new Chronology[][]{ {HijrahChronology.INSTANCE}, {IsoChronology.INSTANCE}, {JapaneseChronology.INSTANCE}, {MinguoChronology.INSTANCE}, {ThaiBuddhistChronology.INSTANCE}, }; }
Example #18
Source File: TCKChronologySerialization.java From hottub with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "invalidSerialformClasses") Object[][] invalid_serial_classes() { return new Object[][]{ {IsoChronology.class}, {JapaneseChronology.class}, {MinguoChronology.class}, {ThaiBuddhistChronology.class}, {HijrahChronology.class}, }; }
Example #19
Source File: TCKChronoZonedDateTime.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "calendars") Chronology[][] data_of_calendars() { return new Chronology[][]{ {HijrahChronology.INSTANCE}, {IsoChronology.INSTANCE}, {JapaneseChronology.INSTANCE}, {MinguoChronology.INSTANCE}, {ThaiBuddhistChronology.INSTANCE}, }; }
Example #20
Source File: TestChronoLocalDate.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod() { Chronology chrono = ThaiBuddhistChronology.INSTANCE; ChronoLocalDate date = chrono.dateNow(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); date = processClassWeird(ThaiBuddhistDate.class); }
Example #21
Source File: TCKChronoPrinterParser.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="parseValid") Object[][] data_parseValid() { return new Object[][] { {"ISO", IsoChronology.INSTANCE}, {"ThaiBuddhist", ThaiBuddhistChronology.INSTANCE}, {"Japanese", JapaneseChronology.INSTANCE}, {"ISO2012", IsoChronology.INSTANCE}, {"ThaiBuddhistXXX", ThaiBuddhistChronology.INSTANCE}, {"JapaneseXXX", JapaneseChronology.INSTANCE}, }; }
Example #22
Source File: TCKThaiBuddhistChronology.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "resolve_ymd") public void test_resolve_ymd_lenient(int y, int m, int d, ThaiBuddhistDate expected, Object smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m); fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d); ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); }
Example #23
Source File: TCKThaiBuddhistChronology.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "resolve_ymaa") public void test_resolve_ymaa_lenient(int y, int m, int w, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m); fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w); fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d); ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); }
Example #24
Source File: TCKThaiBuddhistChronology.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void test_periodUntilDate() { ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1); ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2); ChronoPeriod period = mdate1.until(mdate2); assertEquals(period, ThaiBuddhistChronology.INSTANCE.period(1, 1, 1)); }
Example #25
Source File: TCKDateTimeParseResolver.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_withChronology_parsedChronology_override() { DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).appendChronologyId().toFormatter(); f = f.withChronology(MinguoChronology.INSTANCE); TemporalAccessor accessor = f.parse("ThaiBuddhist"); assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3)); assertEquals(accessor.query(TemporalQueries.localTime()), null); assertEquals(accessor.query(TemporalQueries.chronology()), ThaiBuddhistChronology.INSTANCE); }
Example #26
Source File: TCKThaiBuddhistChronology.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "resolve_yd") public void test_resolve_yd_lenient(int y, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR, (long) y); fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d); ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT); assertEquals(date, expected); assertEquals(fieldValues.size(), 0); }
Example #27
Source File: TCKChronoPeriod.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="calendars", expectedExceptions=DateTimeException.class) public void test_subtractFrom_wrongChrono(Chronology chrono) { ChronoPeriod period = chrono.period(1, 2, 3); ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1); ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1); // one of these two will fail period.subtractFrom(isoDate); period.subtractFrom(thaiDate); }
Example #28
Source File: TCKChronoPeriod.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="calendars", expectedExceptions=DateTimeException.class) public void test_subtractFrom_wrongChrono(Chronology chrono) { ChronoPeriod period = chrono.period(1, 2, 3); ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1); ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1); // one of these two will fail period.subtractFrom(isoDate); period.subtractFrom(thaiDate); }
Example #29
Source File: TestDateTimeFormatter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Test public void test_parse_errorMessage() throws Exception { assertGoodErrorDate(DayOfWeek::from, "DayOfWeek"); assertGoodErrorDate(Month::from, "Month"); assertGoodErrorDate(YearMonth::from, "YearMonth"); assertGoodErrorDate(MonthDay::from, "MonthDay"); assertGoodErrorDate(LocalDate::from, "LocalDate"); assertGoodErrorDate(LocalTime::from, "LocalTime"); assertGoodErrorDate(LocalDateTime::from, "LocalDateTime"); assertGoodErrorDate(OffsetTime::from, "OffsetTime"); assertGoodErrorDate(OffsetDateTime::from, "OffsetDateTime"); assertGoodErrorDate(ZonedDateTime::from, "ZonedDateTime"); assertGoodErrorDate(Instant::from, "Instant"); assertGoodErrorDate(ZoneOffset::from, "ZoneOffset"); assertGoodErrorDate(ZoneId::from, "ZoneId"); assertGoodErrorDate(ThaiBuddhistChronology.INSTANCE::date, ""); assertGoodErrorTime(DayOfWeek::from, "DayOfWeek"); assertGoodErrorTime(Month::from, "Month"); assertGoodErrorTime(Year::from, "Year"); assertGoodErrorTime(YearMonth::from, "YearMonth"); assertGoodErrorTime(MonthDay::from, "MonthDay"); assertGoodErrorTime(LocalDate::from, "LocalDate"); assertGoodErrorTime(LocalTime::from, "LocalTime"); assertGoodErrorTime(LocalDateTime::from, "LocalDateTime"); assertGoodErrorTime(OffsetTime::from, "OffsetTime"); assertGoodErrorTime(OffsetDateTime::from, "OffsetDateTime"); assertGoodErrorTime(ZonedDateTime::from, "ZonedDateTime"); assertGoodErrorTime(Instant::from, "Instant"); assertGoodErrorTime(ZoneOffset::from, "ZoneOffset"); assertGoodErrorTime(ZoneId::from, "ZoneId"); assertGoodErrorTime(ThaiBuddhistChronology.INSTANCE::date, ""); }
Example #30
Source File: TCKThaiBuddhistChronology.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test public void test_Chrono_range() { long minYear = LocalDate.MIN.getYear() + YDIFF; long maxYear = LocalDate.MAX.getYear() + YDIFF; assertEquals(ThaiBuddhistChronology.INSTANCE.range(YEAR), ValueRange.of(minYear, maxYear)); assertEquals(ThaiBuddhistChronology.INSTANCE.range(YEAR_OF_ERA), ValueRange.of(1, -minYear + 1, maxYear)); assertEquals(ThaiBuddhistChronology.INSTANCE.range(DAY_OF_MONTH), DAY_OF_MONTH.range()); assertEquals(ThaiBuddhistChronology.INSTANCE.range(DAY_OF_YEAR), DAY_OF_YEAR.range()); assertEquals(ThaiBuddhistChronology.INSTANCE.range(MONTH_OF_YEAR), MONTH_OF_YEAR.range()); }