use of java.time.chrono.JapaneseEra in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method test_JapaneseEra_singletons.
@Test(dataProvider = "japaneseEras")
public void test_JapaneseEra_singletons(Era expectedEra, int eraValue, String name) {
JapaneseEra actualEra = JapaneseEra.valueOf(name);
assertEquals(actualEra, expectedEra, "JapaneseEra.valueOf(name)");
actualEra = JapaneseEra.of(eraValue);
assertEquals(actualEra, expectedEra, "JapaneseEra.of(value)");
String string = actualEra.toString();
assertEquals(string, name, "JapaneseEra.toString()");
}
use of java.time.chrono.JapaneseEra in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method test_getDayOfYear.
//-----------------------------------------------------------------------
// JapaneseChronology.dateYearDay, getDayOfYear
//-----------------------------------------------------------------------
@Test
public void test_getDayOfYear() {
// Test all the Eras
for (JapaneseEra era : JapaneseEra.values()) {
// Until Era supports range(YEAR_OF_ERA)
int firstYear = (era == JapaneseEra.MEIJI) ? 6 : 1;
JapaneseDate hd1 = JapaneseChronology.INSTANCE.dateYearDay(era, firstYear, 1);
ValueRange range = hd1.range(DAY_OF_YEAR);
assertEquals(range.getMaximum(), hd1.lengthOfYear(), "lengthOfYear should match range.getMaximum()");
for (int i = 1; i <= hd1.lengthOfYear(); i++) {
JapaneseDate hd = JapaneseChronology.INSTANCE.dateYearDay(era, firstYear, i);
int doy = hd.get(DAY_OF_YEAR);
assertEquals(doy, i, "get(DAY_OF_YEAR) incorrect for " + i + ", of date: " + hd);
}
}
}
use of java.time.chrono.JapaneseEra in project jdk8u_jdk by JetBrains.
the class TCKJapaneseEra method test_values.
//-----------------------------------------------------------------------
// values()
//-----------------------------------------------------------------------
@Test
public void test_values() {
List<Era> eraList = JapaneseChronology.INSTANCE.eras();
JapaneseEra[] eras = JapaneseEra.values();
assertEquals(eraList.size(), eras.length);
for (JapaneseEra era : eras) {
assertTrue(eraList.contains(era));
}
}
use of java.time.chrono.JapaneseEra in project jdk8u_jdk by JetBrains.
the class TCKJapaneseEra method test_range.
//-----------------------------------------------------------------------
// range()
//-----------------------------------------------------------------------
@Test
public void test_range() {
// eras may be added after release
for (JapaneseEra era : JapaneseEra.values()) {
assertEquals(era.range(ERA).getMinimum(), -1);
assertEquals(era.range(ERA).getLargestMinimum(), -1);
assertEquals(era.range(ERA).getSmallestMaximum(), era.range(ERA).getMaximum());
assertEquals(era.range(ERA).getMaximum() >= 2, true);
}
}
use of java.time.chrono.JapaneseEra in project jdk8u_jdk by JetBrains.
the class TCKJapaneseChronology method data_resolve_styleByEra.
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
@DataProvider(name = "resolve_styleByEra")
Object[][] data_resolve_styleByEra() {
Object[][] result = new Object[ResolverStyle.values().length * JapaneseEra.values().length][];
int i = 0;
for (ResolverStyle style : ResolverStyle.values()) {
for (JapaneseEra era : JapaneseEra.values()) {
result[i++] = new Object[] { style, era };
}
}
return result;
}
Aggregations