Search in sources :

Example 21 with Chronology

use of java.time.chrono.Chronology in project jdk8u_jdk by JetBrains.

the class TCKChronology method test_IsoChronology_dateYearDay.

@Test
public void test_IsoChronology_dateYearDay() {
    Chronology chrono = Chronology.of("ISO");
    ChronoLocalDate date1 = chrono.dateYearDay(IsoEra.CE, 5, 60);
    ChronoLocalDate date2 = chrono.date(IsoEra.CE, 5, 3, 1);
    assertEquals(date1, IsoChronology.INSTANCE.dateYearDay(IsoEra.CE, 5, 60));
    assertEquals(date2, IsoChronology.INSTANCE.dateYearDay(IsoEra.CE, 5, 60));
}
Also used : ChronoLocalDate(java.time.chrono.ChronoLocalDate) HijrahChronology(java.time.chrono.HijrahChronology) ThaiBuddhistChronology(java.time.chrono.ThaiBuddhistChronology) IsoChronology(java.time.chrono.IsoChronology) Chronology(java.time.chrono.Chronology) MinguoChronology(java.time.chrono.MinguoChronology) JapaneseChronology(java.time.chrono.JapaneseChronology) Test(org.testng.annotations.Test)

Example 22 with Chronology

use of java.time.chrono.Chronology in project jdk8u_jdk by JetBrains.

the class TCKChronology method test_dateEpochDay.

@Test(dataProvider = "calendarNameAndType")
public void test_dateEpochDay(String name, String alias) {
    Chronology chrono = Chronology.of(name);
    ChronoLocalDate date = chrono.dateNow();
    long epochDay = date.getLong(ChronoField.EPOCH_DAY);
    ChronoLocalDate test = chrono.dateEpochDay(epochDay);
    assertEquals(test, date);
}
Also used : ChronoLocalDate(java.time.chrono.ChronoLocalDate) HijrahChronology(java.time.chrono.HijrahChronology) ThaiBuddhistChronology(java.time.chrono.ThaiBuddhistChronology) IsoChronology(java.time.chrono.IsoChronology) Chronology(java.time.chrono.Chronology) MinguoChronology(java.time.chrono.MinguoChronology) JapaneseChronology(java.time.chrono.JapaneseChronology) Test(org.testng.annotations.Test)

Example 23 with Chronology

use of java.time.chrono.Chronology in project jdk8u_jdk by JetBrains.

the class TCKChronology method test_HijrahChronology_dateYearDay.

//-----------------------------------------------------------------------
// dateYearDay() and date()
//-----------------------------------------------------------------------
@Test
public void test_HijrahChronology_dateYearDay() {
    Chronology chrono = Chronology.of("Hijrah");
    ChronoLocalDate date1 = chrono.dateYearDay(HijrahEra.AH, 1434, 178);
    ChronoLocalDate date2 = chrono.date(HijrahEra.AH, 1434, 7, 1);
    assertEquals(date1, HijrahChronology.INSTANCE.dateYearDay(HijrahEra.AH, 1434, 178));
    assertEquals(date2, HijrahChronology.INSTANCE.dateYearDay(HijrahEra.AH, 1434, 178));
}
Also used : ChronoLocalDate(java.time.chrono.ChronoLocalDate) HijrahChronology(java.time.chrono.HijrahChronology) ThaiBuddhistChronology(java.time.chrono.ThaiBuddhistChronology) IsoChronology(java.time.chrono.IsoChronology) Chronology(java.time.chrono.Chronology) MinguoChronology(java.time.chrono.MinguoChronology) JapaneseChronology(java.time.chrono.JapaneseChronology) Test(org.testng.annotations.Test)

Example 24 with Chronology

use of java.time.chrono.Chronology in project jdk8u_jdk by JetBrains.

the class TCKChronology method test_getDisplayName.

@Test(dataProvider = "calendarDisplayName")
public void test_getDisplayName(String chronoId, String calendarDisplayName) {
    Chronology chrono = Chronology.of(chronoId);
    assertEquals(chrono.getDisplayName(TextStyle.FULL, Locale.ENGLISH), calendarDisplayName);
}
Also used : HijrahChronology(java.time.chrono.HijrahChronology) ThaiBuddhistChronology(java.time.chrono.ThaiBuddhistChronology) IsoChronology(java.time.chrono.IsoChronology) Chronology(java.time.chrono.Chronology) MinguoChronology(java.time.chrono.MinguoChronology) JapaneseChronology(java.time.chrono.JapaneseChronology) Test(org.testng.annotations.Test)

Example 25 with Chronology

use of java.time.chrono.Chronology 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));
}
Also used : ChronoLocalDate(java.time.chrono.ChronoLocalDate) HijrahChronology(java.time.chrono.HijrahChronology) ThaiBuddhistChronology(java.time.chrono.ThaiBuddhistChronology) IsoChronology(java.time.chrono.IsoChronology) Chronology(java.time.chrono.Chronology) MinguoChronology(java.time.chrono.MinguoChronology) JapaneseChronology(java.time.chrono.JapaneseChronology) Test(org.testng.annotations.Test)

Aggregations

Chronology (java.time.chrono.Chronology)114 IsoChronology (java.time.chrono.IsoChronology)95 Test (org.testng.annotations.Test)66 ThaiBuddhistChronology (java.time.chrono.ThaiBuddhistChronology)58 MinguoChronology (java.time.chrono.MinguoChronology)54 HijrahChronology (java.time.chrono.HijrahChronology)47 JapaneseChronology (java.time.chrono.JapaneseChronology)46 ChronoLocalDate (java.time.chrono.ChronoLocalDate)42 LocalDate (java.time.LocalDate)39 Test (org.junit.Test)32 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)27 TemporalAmount (java.time.temporal.TemporalAmount)12 TemporalUnit (java.time.temporal.TemporalUnit)12 TemporalAccessor (java.time.temporal.TemporalAccessor)10 TemporalField (java.time.temporal.TemporalField)9 ZoneId (java.time.ZoneId)8 Locale (java.util.Locale)8 DateTimeException (java.time.DateTimeException)6 TemporalAdjuster (java.time.temporal.TemporalAdjuster)6 ArrayList (java.util.ArrayList)6