use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_isValidValue_long_int.
//-----------------------------------------------------------------------
// isValidIntValue(long)
//-----------------------------------------------------------------------
public void test_isValidValue_long_int() {
ValueRange test = ValueRange.of(1, 28, 31);
assertEquals(test.isValidValue(0), false);
assertEquals(test.isValidValue(1), true);
assertEquals(test.isValidValue(31), true);
assertEquals(test.isValidValue(32), false);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_of_longlonglonglong.
@Test(dataProvider = "valid")
public void test_of_longlonglonglong(long sMin, long lMin, long sMax, long lMax) {
ValueRange test = ValueRange.of(sMin, lMin, sMax, lMax);
assertEquals(test.getMinimum(), sMin);
assertEquals(test.getLargestMinimum(), lMin);
assertEquals(test.getSmallestMaximum(), sMax);
assertEquals(test.getMaximum(), lMax);
assertEquals(test.isFixed(), sMin == lMin && sMax == lMax);
assertEquals(test.isIntValue(), true);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_equals1.
//-----------------------------------------------------------------------
// equals() / hashCode()
//-----------------------------------------------------------------------
public void test_equals1() {
ValueRange a = ValueRange.of(1, 2, 3, 4);
ValueRange b = ValueRange.of(1, 2, 3, 4);
assertEquals(a.equals(a), true);
assertEquals(a.equals(b), true);
assertEquals(b.equals(a), true);
assertEquals(b.equals(b), true);
assertEquals(a.hashCode() == b.hashCode(), true);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_checkValidValueUnsupported_long_long.
@Test(expectedExceptions = DateTimeException.class)
public void test_checkValidValueUnsupported_long_long() {
ValueRange test = ValueRange.of(1, 28, Integer.MAX_VALUE + 1L);
test.checkValidIntValue(0, (ChronoField) null);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_equals_otherType.
public void test_equals_otherType() {
ValueRange a = ValueRange.of(1, 12);
assertEquals(a.equals("Rubbish"), false);
}
Aggregations