java.time.chrono.HijrahEra Java Examples

The following examples show how to use java.time.chrono.HijrahEra. 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: TCKChronology.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@DataProvider(name = "era_epochSecond_dataProvider")
Object[][]  data_era_epochSecond() {
    return new Object[][] {
            {JapaneseChronology.INSTANCE, JapaneseEra.MEIJI, 1873 - YDIFF_MEIJI, 9, 7, 1, 2, 2, OFFSET_P0100},
            {JapaneseChronology.INSTANCE, JapaneseEra.SHOWA, 1928 - YDIFF_SHOWA, 2, 28, 1, 2, 2, OFFSET_M0100},
            {JapaneseChronology.INSTANCE, JapaneseEra.HEISEI, 1989 - YDIFF_HEISEI, 1, 8, 1, 2, 2, OFFSET_P0100},
            {HijrahChronology.INSTANCE, HijrahEra.AH, 1434, 9, 7, 1, 2, 2, OFFSET_P0100},
            {MinguoChronology.INSTANCE, MinguoEra.BEFORE_ROC, 1873 - YDIFF_MINGUO, 9, 7, 1, 2, 2, OFFSET_P0100},
            {MinguoChronology.INSTANCE, MinguoEra.ROC, 1928 - YDIFF_MINGUO, 2, 28, 1, 2, 2, OFFSET_M0100},
            {MinguoChronology.INSTANCE, MinguoEra.ROC, 1989 - YDIFF_MINGUO, 1, 8, 1, 2, 2, OFFSET_P0100},
            {ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1873 + YDIFF_THAIBUDDHIST, 9, 7, 1, 2, 2, OFFSET_P0100},
            {ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1928 + YDIFF_THAIBUDDHIST, 2, 28, 1, 2, 2, OFFSET_M0100},
            {ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1989 + YDIFF_THAIBUDDHIST, 1, 8, 1, 2, 2, OFFSET_P0100},
            {IsoChronology.INSTANCE, IsoEra.CE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
            {IsoChronology.INSTANCE, IsoEra.CE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
            {IsoChronology.INSTANCE, IsoEra.CE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},

    };
}
 
Example #2
Source File: TCKHijrahChronology.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "resolve_styleByEra")
Object[][] data_resolve_styleByEra() {
    Object[][] result = new Object[ResolverStyle.values().length * HijrahEra.values().length][];
    int i = 0;
    for (ResolverStyle style : ResolverStyle.values()) {
        for (HijrahEra era : HijrahEra.values()) {
            result[i++] = new Object[] {style, era};
        }
    }
    return result;
}
 
Example #3
Source File: TCKHijrahChronology.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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 #4
Source File: TCKEraSerialization.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "Eras")
Era[][] data_of_calendars() {
    return new Era[][] {
                {HijrahEra.AH},
                {IsoEra.BCE},
                {IsoEra.CE},
                {MinguoEra.BEFORE_ROC},
                {MinguoEra.ROC},
                {ThaiBuddhistEra.BEFORE_BE},
                {ThaiBuddhistEra.BE},
    };
}
 
Example #5
Source File: TCKHijrahEra.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider="HijrahEras")
public void test_valueOf(HijrahEra era , String eraName, int eraValue) {
    assertEquals(era.getValue(), eraValue);

    assertEquals(HijrahChronology.INSTANCE.eraOf(eraValue), era);
    assertEquals(HijrahEra.of(eraValue), era);
    assertEquals(HijrahEra.valueOf(eraName), era);
}
 
Example #6
Source File: TCKChronology.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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));
}
 
Example #7
Source File: TCKChronology.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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));
}
 
Example #8
Source File: TCKHijrahChronology.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "resolve_styleByEra")
Object[][] data_resolve_styleByEra() {
    Object[][] result = new Object[ResolverStyle.values().length * HijrahEra.values().length][];
    int i = 0;
    for (ResolverStyle style : ResolverStyle.values()) {
        for (HijrahEra era : HijrahEra.values()) {
            result[i++] = new Object[] {style, era};
        }
    }
    return result;
}
 
Example #9
Source File: TCKHijrahChronology.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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 #10
Source File: TCKHijrahChronology.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraAndYearOfEraOnly_valid(ResolverStyle style, HijrahEra era) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.ERA, (long) era.getValue());
    fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
    HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
    assertEquals(date, null);
    assertEquals(fieldValues.get(ChronoField.ERA), null);
    assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), null);
    assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
    assertEquals(fieldValues.size(), 1);
}
 
Example #11
Source File: TCKHijrahChronology.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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 #12
Source File: TCKEraSerialization.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "Eras")
Era[][] data_of_calendars() {
    return new Era[][] {
                {HijrahEra.AH},
                {IsoEra.BCE},
                {IsoEra.CE},
                {MinguoEra.BEFORE_ROC},
                {MinguoEra.ROC},
                {ThaiBuddhistEra.BEFORE_BE},
                {ThaiBuddhistEra.BE},
    };
}
 
Example #13
Source File: TCKChronology.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@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));
}
 
Example #14
Source File: TCKEraSerialization.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "Eras")
Era[][] data_of_calendars() {
    return new Era[][] {
                {HijrahEra.AH},
                {IsoEra.BCE},
                {IsoEra.CE},
                {MinguoEra.BEFORE_ROC},
                {MinguoEra.ROC},
                {ThaiBuddhistEra.BEFORE_BE},
                {ThaiBuddhistEra.BE},
    };
}
 
Example #15
Source File: TCKHijrahChronology.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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 #16
Source File: TCKChronology.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@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));
}
 
Example #17
Source File: TCKHijrahChronology.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "resolve_styleByEra")
Object[][] data_resolve_styleByEra() {
    Object[][] result = new Object[ResolverStyle.values().length * HijrahEra.values().length][];
    int i = 0;
    for (ResolverStyle style : ResolverStyle.values()) {
        for (HijrahEra era : HijrahEra.values()) {
            result[i++] = new Object[] {style, era};
        }
    }
    return result;
}
 
Example #18
Source File: TCKHijrahEra.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider="HijrahEras")
public void test_valueOf(HijrahEra era , String eraName, int eraValue) {
    assertEquals(era.getValue(), eraValue);

    assertEquals(HijrahChronology.INSTANCE.eraOf(eraValue), era);
    assertEquals(HijrahEra.of(eraValue), era);
    assertEquals(HijrahEra.valueOf(eraName), era);
}
 
Example #19
Source File: TCKHijrahChronology.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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 #20
Source File: TCKHijrahChronology.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "resolve_styleByEra")
Object[][] data_resolve_styleByEra() {
    Object[][] result = new Object[ResolverStyle.values().length * HijrahEra.values().length][];
    int i = 0;
    for (ResolverStyle style : ResolverStyle.values()) {
        for (HijrahEra era : HijrahEra.values()) {
            result[i++] = new Object[] {style, era};
        }
    }
    return result;
}
 
Example #21
Source File: TCKHijrahChronology.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@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 #22
Source File: TCKHijrahChronology.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraAndYearOfEraOnly_valid(ResolverStyle style, HijrahEra era) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.ERA, (long) era.getValue());
    fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
    HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
    assertEquals(date, null);
    assertEquals(fieldValues.get(ChronoField.ERA), null);
    assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), null);
    assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
    assertEquals(fieldValues.size(), 1);
}
 
Example #23
Source File: TCKHijrahChronology.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@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 #24
Source File: TCKEraSerialization.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "Eras")
Era[][] data_of_calendars() {
    return new Era[][] {
                {HijrahEra.AH},
                {IsoEra.BCE},
                {IsoEra.CE},
                {MinguoEra.BEFORE_ROC},
                {MinguoEra.ROC},
                {ThaiBuddhistEra.BEFORE_BE},
                {ThaiBuddhistEra.BE},
    };
}
 
Example #25
Source File: TCKHijrahChronology.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraAndYearOfEraOnly_valid(ResolverStyle style, HijrahEra era) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.ERA, (long) era.getValue());
    fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
    HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
    assertEquals(date, null);
    assertEquals(fieldValues.get(ChronoField.ERA), null);
    assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), null);
    assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
    assertEquals(fieldValues.size(), 1);
}
 
Example #26
Source File: TCKChronology.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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));
}
 
Example #27
Source File: TCKHijrahChronology.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "resolve_styleByEra")
Object[][] data_resolve_styleByEra() {
    Object[][] result = new Object[ResolverStyle.values().length * HijrahEra.values().length][];
    int i = 0;
    for (ResolverStyle style : ResolverStyle.values()) {
        for (HijrahEra era : HijrahEra.values()) {
            result[i++] = new Object[] {style, era};
        }
    }
    return result;
}
 
Example #28
Source File: TCKEraSerialization.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "Eras")
Era[][] data_of_calendars() {
    return new Era[][] {
                {HijrahEra.AH},
                {IsoEra.BCE},
                {IsoEra.CE},
                {MinguoEra.BEFORE_ROC},
                {MinguoEra.ROC},
                {ThaiBuddhistEra.BEFORE_BE},
                {ThaiBuddhistEra.BE},
    };
}
 
Example #29
Source File: TCKEraSerialization.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "Eras")
Era[][] data_of_calendars() {
    return new Era[][] {
                {HijrahEra.AH},
                {IsoEra.BCE},
                {IsoEra.CE},
                {MinguoEra.BEFORE_ROC},
                {MinguoEra.ROC},
                {ThaiBuddhistEra.BEFORE_BE},
                {ThaiBuddhistEra.BE},
    };
}
 
Example #30
Source File: TCKHijrahChronology.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@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);
}