use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_checkValidValueInvalid_long_long.
@Test(expectedExceptions = DateTimeException.class)
public void test_checkValidValueInvalid_long_long() {
ValueRange test = ValueRange.of(1, 28, Integer.MAX_VALUE + 1L);
test.checkValidIntValue(Integer.MAX_VALUE + 2L, (ChronoField) null);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TCKValueRangeSerialization method test_serialization.
//-----------------------------------------------------------------------
// Serialization
//-----------------------------------------------------------------------
public void test_serialization() throws Exception {
ValueRange range = ValueRange.of(1, 2, 3, 4);
assertSerializable(range);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestUmmAlQuraChronology method test_hijrahDateLimits.
// Check the date limits
@Test
public void test_hijrahDateLimits() {
HijrahChronology chrono = HijrahChronology.INSTANCE;
ValueRange yearRange = chrono.range(YEAR);
ValueRange monthRange = chrono.range(MONTH_OF_YEAR);
ValueRange dayRange = chrono.range(DAY_OF_MONTH);
HijrahDate xx = chrono.date(1434, 1, 1);
HijrahDate minDate = chrono.date((int) yearRange.getLargestMinimum(), (int) monthRange.getMinimum(), (int) dayRange.getMinimum());
try {
HijrahDate before = minDate.minus(1, ChronoUnit.DAYS);
fail("Exception did not occur, minDate: " + minDate + ".minus(1, DAYS) = " + before);
} catch (DateTimeException ex) {
// ignore, this exception was expected
}
HijrahDate maxDate = chrono.date((int) yearRange.getSmallestMaximum(), (int) monthRange.getMaximum(), 1);
int monthLen = maxDate.lengthOfMonth();
maxDate = maxDate.with(DAY_OF_MONTH, monthLen);
try {
HijrahDate after = maxDate.plus(1, ChronoUnit.DAYS);
fail("Exception did not occur, maxDate: " + maxDate + ".plus(1, DAYS) = " + after);
} catch (DateTimeException ex) {
// ignore, this exception was expected
}
}
Aggregations