java.time.chrono.HijrahDate Java Examples
The following examples show how to use
java.time.chrono.HijrahDate.
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: TCKHijrahChronology.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Test public void test_dateNow(){ assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now()) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(ZoneId.systemDefault())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(Clock.systemDefaultZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(Clock.systemDefaultZone().getZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(ZoneId.systemDefault())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(Clock.systemDefaultZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(Clock.systemDefaultZone().getZone())) ; ZoneId zoneId = ZoneId.of("Europe/Paris"); assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahChronology.INSTANCE.dateNow(Clock.system(zoneId))) ; assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahChronology.INSTANCE.dateNow(Clock.system(zoneId).getZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahDate.now(Clock.system(zoneId))) ; assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahDate.now(Clock.system(zoneId).getZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(ZoneId.of(ZoneOffset.UTC.getId())), HijrahChronology.INSTANCE.dateNow(Clock.systemUTC())) ; }
Example #2
Source File: TCKHijrahChronology.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test public void test_dateNow(){ assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now()) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(ZoneId.systemDefault())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(Clock.systemDefaultZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(Clock.systemDefaultZone().getZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(ZoneId.systemDefault())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(Clock.systemDefaultZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(Clock.systemDefaultZone().getZone())) ; ZoneId zoneId = ZoneId.of("Europe/Paris"); assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahChronology.INSTANCE.dateNow(Clock.system(zoneId))) ; assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahChronology.INSTANCE.dateNow(Clock.system(zoneId).getZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahDate.now(Clock.system(zoneId))) ; assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahDate.now(Clock.system(zoneId).getZone())) ; assertEquals(HijrahChronology.INSTANCE.dateNow(ZoneId.of(ZoneOffset.UTC.getId())), HijrahChronology.INSTANCE.dateNow(Clock.systemUTC())) ; }
Example #3
Source File: TCKChronoLocalDateSerialization.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "invalidSerialformClasses") Object[][] invalid_serial_classes() { return new Object[][]{ {JapaneseEra.class}, {JapaneseDate.class}, {MinguoDate.class}, {ThaiBuddhistDate.class}, {HijrahDate.class}, }; }
Example #4
Source File: TCKHijrahChronology.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "resolve_styleByEra") public void test_resolve_yearOfEra_eraOnly_valid(ResolverStyle style, HijrahEra era) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.ERA, (long) era.getValue()); HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style); assertEquals(date, null); assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue()); assertEquals(fieldValues.size(), 1); }
Example #5
Source File: TestUmmAlQuraChronology.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "dates") Object[][] data_dates() { return new Object[][]{ {HijrahDate.of(1300, 5, 1), 1300, 1600, 1, 12, 1, 30, 30}, {HijrahDate.of(1300, 6, 1), 1300, 1600, 1, 12, 1, 29, 30}, {HijrahDate.of(1434, 12, 1), 1300, 1600, 1, 12, 1, 29, 30}, {HijrahDate.of(1500, 4, 1), 1300, 1600, 1, 12, 1, 30, 30}, {HijrahDate.of(1600, 6, 1), 1300, 1600, 1, 12, 1, 29, 30}, }; }
Example #6
Source File: TestUmmAlQuraChronology.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_getDayOfYear() { HijrahDate hd1 = HijrahChronology.INSTANCE.dateYearDay(1434, 1); for (int i = 1; i <= hd1.lengthOfYear(); i++) { HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(1434, i); int doy = hd.get(DAY_OF_YEAR); assertEquals(doy, i, "get(DAY_OF_YEAR) incorrect for " + i); } }
Example #7
Source File: TestExampleCode.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
void HijrahExample1() { HijrahDate hd2 = HijrahChronology.INSTANCE.date(1200, 1, 1); ChronoLocalDateTime<HijrahDate> hdt = hd2.atTime(LocalTime.MIDNIGHT); ChronoZonedDateTime<HijrahDate> zhdt = hdt.atZone(ZoneId.of("GMT")); HijrahDate hd3 = zhdt.toLocalDate(); ChronoLocalDateTime<HijrahDate> hdt2 = zhdt.toLocalDateTime(); HijrahDate hd4 = hdt2.toLocalDate(); HijrahDate hd5 = next(hd2); }
Example #8
Source File: TestUmmAlQuraChronology.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void test_temporalDayAdjustments() { HijrahDate date = HijrahDate.of(1554, 7, 21); assertEquals(date.with(TemporalAdjusters.firstDayOfMonth()), HijrahDate.of(1554, 7, 1)); assertEquals(date.with(TemporalAdjusters.lastDayOfMonth()), HijrahDate.of(1554, 7, 29)); assertEquals(date.with(TemporalAdjusters.firstDayOfNextMonth()), HijrahDate.of(1554, 8, 1)); assertEquals(date.with(TemporalAdjusters.firstDayOfNextYear()), HijrahDate.of(1555, 1, 1)); assertEquals(date.with(TemporalAdjusters.firstDayOfYear()), HijrahDate.of(1554, 1, 1)); assertEquals(date.with(TemporalAdjusters.lastDayOfYear()), HijrahDate.of(1554, 12, 30)); }
Example #9
Source File: TestUmmAlQuraChronology.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="hijrahToThai") Object[][] data_hijrahToThai() { return new Object[][] { {HijrahDate.of(1350,5,15), ThaiBuddhistDate.of(2474,9,28)}, {HijrahDate.of(1434,5,1), ThaiBuddhistDate.of(2556,3,13)}, {HijrahDate.of(1436,1,1), ThaiBuddhistDate.of(2557,10,25)}, {HijrahDate.of(1500,6,12), ThaiBuddhistDate.of(2620,5,5)}, {HijrahDate.of(1550,3,11), ThaiBuddhistDate.of(2668,8,11)}, }; }
Example #10
Source File: TCKChronoLocalDateSerialization.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "invalidSerialformClasses") Object[][] invalid_serial_classes() { return new Object[][]{ {JapaneseEra.class}, {JapaneseDate.class}, {MinguoDate.class}, {ThaiBuddhistDate.class}, {HijrahDate.class}, }; }
Example #11
Source File: TestExampleCode.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void HijrahExample1() { HijrahDate hd2 = HijrahChronology.INSTANCE.date(1200, 1, 1); ChronoLocalDateTime<HijrahDate> hdt = hd2.atTime(LocalTime.MIDNIGHT); ChronoZonedDateTime<HijrahDate> zhdt = hdt.atZone(ZoneId.of("GMT")); HijrahDate hd3 = zhdt.toLocalDate(); ChronoLocalDateTime<HijrahDate> hdt2 = zhdt.toLocalDateTime(); HijrahDate hd4 = hdt2.toLocalDate(); HijrahDate hd5 = next(hd2); }
Example #12
Source File: TestUmmAlQuraChronology.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_adjustInto() { assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1434, 6, 28)), HijrahDate.of(1434, 7, 1)); assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1432, 4, 13)), HijrahDate.of(1432, 4, 14)); assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1433, 11, 29)), HijrahDate.of(1433, 12, 4)); assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1434, 5, 10)), HijrahDate.of(1434, 5, 11)); assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1434, 9, 11)), HijrahDate.of(1434, 9, 12)); }
Example #13
Source File: TestTextParserWithLocale.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="parseChronoLocalDate") Object[][] provider_chronoLocalDate() { return new Object[][] { { HijrahDate.now() }, { JapaneseDate.now() }, { MinguoDate.now() }, { ThaiBuddhistDate.now() }}; }
Example #14
Source File: TestUmmAlQuraChronology.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="hijrahToJapanese") Object[][] data_hijrahToJapanese() { return new Object[][] { {HijrahDate.of(1350,5,15), "Japanese Showa 6-09-28"}, {HijrahDate.of(1434,5,1), "Japanese Heisei 25-03-13"}, {HijrahDate.of(1436,1,1), "Japanese Heisei 26-10-25"}, {HijrahDate.of(1500,6,12), "Japanese Heisei 89-05-05"}, {HijrahDate.of(1550,3,11), "Japanese Heisei 137-08-11"}, }; }
Example #15
Source File: TestUmmAlQuraChronology.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_getDayOfYear() { HijrahDate hd1 = HijrahChronology.INSTANCE.dateYearDay(1434, 1); for (int i = 1; i <= hd1.lengthOfYear(); i++) { HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(1434, i); int doy = hd.get(DAY_OF_YEAR); assertEquals(doy, i, "get(DAY_OF_YEAR) incorrect for " + i); } }
Example #16
Source File: TestUmmAlQuraChronology.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_Instant_zonedDateTime() { OffsetDateTime offsetDateTime = OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO); ZonedDateTime zonedDateTime = ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_RIYADH); ChronoZonedDateTime<HijrahDate> result = HijrahChronology.INSTANCE.zonedDateTime(offsetDateTime.toInstant(), offsetDateTime.getOffset()); assertEquals(result.toLocalDate(), HijrahChronology.INSTANCE.date(1433, 4, 7)); assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1)); result = HijrahChronology.INSTANCE.zonedDateTime(zonedDateTime.toInstant(), zonedDateTime.getOffset()); assertEquals(result.toLocalDate(), HijrahChronology.INSTANCE.date(1433, 4, 7)); assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1)); }
Example #17
Source File: TestUmmAlQuraChronology.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_temporalDayAdjustments() { HijrahDate date = HijrahDate.of(1554, 7, 21); assertEquals(date.with(TemporalAdjusters.firstDayOfMonth()), HijrahDate.of(1554, 7, 1)); assertEquals(date.with(TemporalAdjusters.lastDayOfMonth()), HijrahDate.of(1554, 7, 29)); assertEquals(date.with(TemporalAdjusters.firstDayOfNextMonth()), HijrahDate.of(1554, 8, 1)); assertEquals(date.with(TemporalAdjusters.firstDayOfNextYear()), HijrahDate.of(1555, 1, 1)); assertEquals(date.with(TemporalAdjusters.firstDayOfYear()), HijrahDate.of(1554, 1, 1)); assertEquals(date.with(TemporalAdjusters.lastDayOfYear()), HijrahDate.of(1554, 12, 30)); }
Example #18
Source File: TestUmmAlQuraChronology.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="hijrahToJapanese") Object[][] data_hijrahToJapanese() { return new Object[][] { {HijrahDate.of(1350,5,15), "Japanese Showa 6-09-28"}, {HijrahDate.of(1434,5,1), "Japanese Heisei 25-03-13"}, {HijrahDate.of(1436,1,1), "Japanese Heisei 26-10-25"}, {HijrahDate.of(1440,8,25), "Japanese Heisei 31-04-30"}, {HijrahDate.of(1440,8,26), "Japanese Reiwa 1-05-01"}, {HijrahDate.of(1500,6,12), "Japanese Reiwa 59-05-05"}, {HijrahDate.of(1550,3,11), "Japanese Reiwa 107-08-11"}, }; }
Example #19
Source File: TestUmmAlQuraChronology.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test public void test_getDayOfYear() { HijrahDate hd1 = HijrahChronology.INSTANCE.dateYearDay(1434, 1); for (int i = 1; i <= hd1.lengthOfYear(); i++) { HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(1434, i); int doy = hd.get(DAY_OF_YEAR); assertEquals(doy, i, "get(DAY_OF_YEAR) incorrect for " + i); } }
Example #20
Source File: TestUmmAlQuraChronology.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="dates") public void Test_UmmAlQuraRanges(HijrahDate date, int minYear, int maxYear, int minMonth, int maxMonth, int minDay, int maxDay, int maxChronoDay) { // Check the chronology ranges HijrahChronology chrono = date.getChronology(); ValueRange yearRange = chrono.range(YEAR); assertEquals(yearRange.getMinimum(), minYear, "Minimum year for Hijrah chronology"); assertEquals(yearRange.getLargestMinimum(), minYear, "Largest minimum year for Hijrah chronology"); assertEquals(yearRange.getMaximum(), maxYear, "Maximum year for Hijrah chronology"); assertEquals(yearRange.getSmallestMaximum(), maxYear, "Smallest Maximum year for Hijrah chronology"); ValueRange monthRange = chrono.range(MONTH_OF_YEAR); assertEquals(monthRange.getMinimum(), minMonth, "Minimum month for Hijrah chronology"); assertEquals(monthRange.getMaximum(), maxMonth, "Maximum month for Hijrah chronology"); ValueRange daysRange = chrono.range(DAY_OF_MONTH); assertEquals(daysRange.getMinimum(), minDay, "Minimum day for chronology"); assertEquals(daysRange.getMaximum(), maxChronoDay, "Maximum day for Hijrah chronology"); // Check the date ranges yearRange = date.range(YEAR); assertEquals(yearRange.getMinimum(), minYear, "Minimum year for Hijrah date"); assertEquals(yearRange.getLargestMinimum(), minYear, "Largest minimum year for Hijrah date"); assertEquals(yearRange.getMaximum(), maxYear, "Maximum year for Hijrah date"); assertEquals(yearRange.getSmallestMaximum(), maxYear, "Smallest maximum year for Hijrah date"); monthRange = date.range(MONTH_OF_YEAR); assertEquals(monthRange.getMinimum(), minMonth, "Minimum month for HijrahDate"); assertEquals(monthRange.getMaximum(), maxMonth, "Maximum month for HijrahDate"); daysRange = date.range(DAY_OF_MONTH); assertEquals(daysRange.getMinimum(), minDay, "Minimum day for HijrahDate"); assertEquals(daysRange.getMaximum(), maxDay, "Maximum day for HijrahDate"); }
Example #21
Source File: TCKHijrahChronology.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "resolve_styleByEra") public void test_resolve_yearOfEra_eraAndYearOnly_valid(ResolverStyle style, HijrahEra era) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.ERA, (long) era.getValue()); fieldValues.put(ChronoField.YEAR, 1343L); HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style); assertEquals(date, null); assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue()); assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L); assertEquals(fieldValues.size(), 2); }
Example #22
Source File: TestUmmAlQuraChronology.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="chronoDateTimes") public void test_formatterOfLocalizedDate(int year, int month, int day, String expected) { HijrahDate hd = HijrahChronology.INSTANCE.date(year, month, day); ChronoLocalDateTime<HijrahDate> hdt = hd.atTime(LocalTime.NOON); hdt = hdt.plus(1, ChronoUnit.YEARS); hdt = hdt.plus(1, ChronoUnit.MONTHS); hdt = hdt.plus(1, ChronoUnit.DAYS); hdt = hdt.plus(1, ChronoUnit.HOURS); hdt = hdt.plus(1, ChronoUnit.MINUTES); hdt = hdt.plus(1, ChronoUnit.SECONDS); DateTimeFormatter df = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG).withChronology(Chronology.of("Hijrah-umalqura")).withLocale(Locale.US); assertEquals(df.format(hdt), expected); }
Example #23
Source File: TCKChronoLocalDateSerialization.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "invalidSerialformClasses") Object[][] invalid_serial_classes() { return new Object[][]{ {JapaneseEra.class}, {JapaneseDate.class}, {MinguoDate.class}, {ThaiBuddhistDate.class}, {HijrahDate.class}, }; }
Example #24
Source File: TestExampleCode.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
void HijrahExample1() { HijrahDate hd2 = HijrahChronology.INSTANCE.date(1200, 1, 1); ChronoLocalDateTime<HijrahDate> hdt = hd2.atTime(LocalTime.MIDNIGHT); ChronoZonedDateTime<HijrahDate> zhdt = hdt.atZone(ZoneId.of("GMT")); HijrahDate hd3 = zhdt.toLocalDate(); ChronoLocalDateTime<HijrahDate> hdt2 = zhdt.toLocalDateTime(); HijrahDate hd4 = hdt2.toLocalDate(); HijrahDate hd5 = next(hd2); }
Example #25
Source File: TestUmmAlQuraChronology.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_adjustWithDayOfYear() { assertEquals(HijrahChronology.INSTANCE.date(1320, 1, 15).with(ChronoField.DAY_OF_YEAR, 24), HijrahDate.of(1320, 1, 24)); assertEquals(HijrahChronology.INSTANCE.date(1421, 11, 15).with(ChronoField.DAY_OF_YEAR, 135), HijrahDate.of(1421, 5, 18)); assertEquals(HijrahChronology.INSTANCE.date(1529, 7, 18).with(ChronoField.DAY_OF_YEAR, 64), HijrahDate.of(1529, 3, 5)); assertEquals(HijrahChronology.INSTANCE.date(1534, 2, 10).with(ChronoField.DAY_OF_YEAR, 354), HijrahDate.of(1534, 12, 29)); assertEquals(HijrahChronology.INSTANCE.date(1552, 4, 1).with(ChronoField.DAY_OF_YEAR, 291), HijrahDate.of(1552, 10, 26)); }
Example #26
Source File: TCKHijrahChronology.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "resolve_styles") public void test_resolve_yearOfEra_yearOfEraOnly_valid(ResolverStyle style) { Map<TemporalField, Long> fieldValues = new HashMap<>(); fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L); HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style); assertEquals(date, null); assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), (style != ResolverStyle.STRICT) ? null : (Long) 1343L); assertEquals(fieldValues.get(ChronoField.YEAR), (style == ResolverStyle.STRICT) ? null : (Long) 1343L); assertEquals(fieldValues.size(), 1); }
Example #27
Source File: TestUmmAlQuraChronology.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="dayOfWeek") Object[][] data_dayOfweek() { return new Object[][] { {HijrahDate.of(1434, 6, 24), 1, 7}, {HijrahDate.of(1432, 9, 3), 5, 4}, {HijrahDate.of(1334, 12, 29), 7, 6}, {HijrahDate.of(1354, 5, 24), 1, 7}, {HijrahDate.of(1465, 10, 2), 2, 1}, }; }
Example #28
Source File: TestUmmAlQuraChronology.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="dates") public void Test_UmmAlQuraRanges(HijrahDate date, int minYear, int maxYear, int minMonth, int maxMonth, int minDay, int maxDay, int maxChronoDay) { // Check the chronology ranges HijrahChronology chrono = date.getChronology(); ValueRange yearRange = chrono.range(YEAR); assertEquals(yearRange.getMinimum(), minYear, "Minimum year for Hijrah chronology"); assertEquals(yearRange.getLargestMinimum(), minYear, "Largest minimum year for Hijrah chronology"); assertEquals(yearRange.getMaximum(), maxYear, "Maximum year for Hijrah chronology"); assertEquals(yearRange.getSmallestMaximum(), maxYear, "Smallest Maximum year for Hijrah chronology"); ValueRange monthRange = chrono.range(MONTH_OF_YEAR); assertEquals(monthRange.getMinimum(), minMonth, "Minimum month for Hijrah chronology"); assertEquals(monthRange.getMaximum(), maxMonth, "Maximum month for Hijrah chronology"); ValueRange daysRange = chrono.range(DAY_OF_MONTH); assertEquals(daysRange.getMinimum(), minDay, "Minimum day for chronology"); assertEquals(daysRange.getMaximum(), maxChronoDay, "Maximum day for Hijrah chronology"); // Check the date ranges yearRange = date.range(YEAR); assertEquals(yearRange.getMinimum(), minYear, "Minimum year for Hijrah date"); assertEquals(yearRange.getLargestMinimum(), minYear, "Largest minimum year for Hijrah date"); assertEquals(yearRange.getMaximum(), maxYear, "Maximum year for Hijrah date"); assertEquals(yearRange.getSmallestMaximum(), maxYear, "Smallest maximum year for Hijrah date"); monthRange = date.range(MONTH_OF_YEAR); assertEquals(monthRange.getMinimum(), minMonth, "Minimum month for HijrahDate"); assertEquals(monthRange.getMaximum(), maxMonth, "Maximum month for HijrahDate"); daysRange = date.range(DAY_OF_MONTH); assertEquals(daysRange.getMinimum(), minDay, "Minimum day for HijrahDate"); assertEquals(daysRange.getMaximum(), maxDay, "Maximum day for HijrahDate"); }
Example #29
Source File: TestUmmAlQuraChronology.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "dates") Object[][] data_dates() { return new Object[][]{ {HijrahDate.of(1300, 5, 1), 1300, 1600, 1, 12, 1, 30, 30}, {HijrahDate.of(1300, 6, 1), 1300, 1600, 1, 12, 1, 29, 30}, {HijrahDate.of(1434, 12, 1), 1300, 1600, 1, 12, 1, 29, 30}, {HijrahDate.of(1500, 4, 1), 1300, 1600, 1, 12, 1, 30, 30}, {HijrahDate.of(1600, 6, 1), 1300, 1600, 1, 12, 1, 29, 30}, }; }
Example #30
Source File: TCKChronoLocalDateSerialization.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Test() public void test_hijrahSerialization_format() throws Exception { HijrahChronology chrono = HijrahChronology.INSTANCE; HijrahDate date = HijrahDate.of(1433, 10, 29); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // Expect the type of the HijrahDate in the stream byte[] hijrahDateBytes = new byte[] {HIJRAH_DATE_TYPE}; // Literal reference to Hijrah-Umalqura Chronology byte[] hijrahChronoBytes = new byte[] { 115, 113, 0, 126, 0, 0, /* p w \u0001 \u0006 s q \u0000 ~ \u0000 \u0000 */ 119, 18, 1, 0, 15, 72, 105, 106, 114, 97, /* w \u0012 \u0001 \u0000 \u000f H i j r a */ 104, 45, 117, 109, 97, 108, 113, 117, 114, 97, /* h - u m a l q u r a */ 120, /* \u001d x */ }; // Build the sequence that represents the data in the stream baos = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(baos) ) { dos.writeByte(ObjectStreamConstants.TC_BLOCKDATA); dos.writeByte(6); // 6 bytes follow dos.writeInt(date.get(YEAR)); dos.writeByte(date.get(MONTH_OF_YEAR)); dos.writeByte(date.get(DAY_OF_MONTH)); dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA); } byte[] dateBytes = baos.toByteArray(); assertSerializedBySer(date, hijrahDateBytes, hijrahChronoBytes, dateBytes); }