use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TCKChronology method test_JapaneseChronology_dateYearDay.
@Test
public void test_JapaneseChronology_dateYearDay() {
Chronology chrono = Chronology.of("Japanese");
ChronoLocalDate date1 = chrono.dateYearDay(JapaneseEra.HEISEI, 8, 60);
ChronoLocalDate date2 = chrono.date(JapaneseEra.HEISEI, 8, 2, 29);
assertEquals(date1, JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.HEISEI, 8, 60));
assertEquals(date2, JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.HEISEI, 8, 60));
}
use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TestNonIsoFormatter method test_parseLocalizedText.
@Test(dataProvider = "format_data")
public void test_parseLocalizedText(Chronology chrono, Locale formatLocale, Locale numberingLocale, ChronoLocalDate expected, String text) {
DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL).withChronology(chrono).withLocale(formatLocale).withDecimalStyle(DecimalStyle.of(numberingLocale));
TemporalAccessor temporal = dtf.parse(text);
ChronoLocalDate date = chrono.date(temporal);
assertEquals(date, expected);
}
use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TCKCopticSerialization method test_eraSerialization.
@Test
public void test_eraSerialization() throws IOException, ClassNotFoundException {
Chronology chrono = Chronology.of("Coptic");
ChronoLocalDate copticDate = chrono.date(1729, 4, 27);
assertSerializable(copticDate);
}
use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TestExampleCode method test_calendarPackageExample.
@Test
public void test_calendarPackageExample() {
// Enumerate the list of available calendars and print today for each
Set<Chronology> chronos = Chronology.getAvailableChronologies();
for (Chronology chrono : chronos) {
ChronoLocalDate date = chrono.dateNow();
System.out.printf(" %20s: %s%n", chrono.getId(), date.toString());
}
// Print the Thai Buddhist date
ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
int day = now1.get(ChronoField.DAY_OF_MONTH);
int dow = now1.get(ChronoField.DAY_OF_WEEK);
int month = now1.get(ChronoField.MONTH_OF_YEAR);
int year = now1.get(ChronoField.YEAR);
System.out.printf(" Today is %s %s %d-%s-%d%n", now1.getChronology().getId(), dow, day, month, year);
// Print today's date and the last day of the year for the Thai Buddhist Calendar.
ThaiBuddhistDate first = now1.with(ChronoField.DAY_OF_MONTH, 1).with(ChronoField.MONTH_OF_YEAR, 1);
ThaiBuddhistDate last = first.plus(1, ChronoUnit.YEARS).minus(1, ChronoUnit.DAYS);
System.out.printf(" %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(), first, last);
}
use of java.time.chrono.ChronoLocalDate in project jdk8u_jdk by JetBrains.
the class TestUmmAlQuraChronology method test_chronoFields.
// Test to verify the values of various chrono fields for a given hijrah date instance
@Test
public void test_chronoFields() {
ChronoLocalDate hdate = HijrahChronology.INSTANCE.date(1434, 6, 28);
assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), 3);
assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), 7);
assertEquals(hdate.get(ChronoField.ALIGNED_WEEK_OF_MONTH), 4);
assertEquals(hdate.get(ChronoField.ALIGNED_WEEK_OF_YEAR), 25);
assertEquals(hdate.get(ChronoField.ERA), 1);
assertEquals(hdate.get(ChronoField.YEAR_OF_ERA), 1434);
assertEquals(hdate.get(ChronoField.MONTH_OF_YEAR), 6);
assertEquals(hdate.get(ChronoField.DAY_OF_MONTH), 28);
assertEquals(hdate.get(ChronoField.DAY_OF_WEEK), 3);
assertEquals(hdate.get(ChronoField.DAY_OF_YEAR), 175);
}
Aggregations