use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_of_longlong.
//-----------------------------------------------------------------------
// of(long,long)
//-----------------------------------------------------------------------
public void test_of_longlong() {
ValueRange test = ValueRange.of(1, 12);
assertEquals(test.getMinimum(), 1);
assertEquals(test.getLargestMinimum(), 1);
assertEquals(test.getSmallestMaximum(), 12);
assertEquals(test.getMaximum(), 12);
assertEquals(test.isFixed(), true);
assertEquals(test.isIntValue(), true);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_isValidValue_long_long.
public void test_isValidValue_long_long() {
ValueRange test = ValueRange.of(1, 28, Integer.MAX_VALUE + 1L);
assertEquals(test.isValidIntValue(0), false);
assertEquals(test.isValidIntValue(1), false);
assertEquals(test.isValidIntValue(31), false);
assertEquals(test.isValidIntValue(32), false);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_equals_null.
public void test_equals_null() {
ValueRange a = ValueRange.of(1, 12);
assertEquals(a.equals(null), false);
}
use of java.time.temporal.ValueRange 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.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestUmmAlQuraChronology method Test_UmmAlQuraChronoRange.
// UmmAlQura chronology ranges for year, month and days for the HijrahChronology
@Test
public void Test_UmmAlQuraChronoRange() {
HijrahChronology chrono = HijrahChronology.INSTANCE;
ValueRange year = chrono.range(YEAR);
assertEquals(year.getMinimum(), 1300, "Minimum year");
assertEquals(year.getLargestMinimum(), 1300, "Largest minimum year");
assertEquals(year.getMaximum(), 1600, "Largest year");
assertEquals(year.getSmallestMaximum(), 1600, "Smallest Maximum year");
ValueRange month = chrono.range(MONTH_OF_YEAR);
assertEquals(month.getMinimum(), 1, "Minimum month");
assertEquals(month.getLargestMinimum(), 1, "Largest minimum month");
assertEquals(month.getMaximum(), 12, "Largest month");
assertEquals(month.getSmallestMaximum(), 12, "Smallest Maximum month");
ValueRange day = chrono.range(DAY_OF_MONTH);
assertEquals(day.getMinimum(), 1, "Minimum day");
assertEquals(day.getLargestMinimum(), 1, "Largest minimum day");
assertEquals(day.getMaximum(), 30, "Largest day");
assertEquals(day.getSmallestMaximum(), 29, "Smallest Maximum day");
}
Aggregations