use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_isValidValue_long.
//-----------------------------------------------------------------------
// isValidValue(long)
//-----------------------------------------------------------------------
public void test_isValidValue_long() {
ValueRange test = ValueRange.of(1, 28, 31);
assertEquals(test.isValidValue(0), false);
assertEquals(test.isValidValue(1), true);
assertEquals(test.isValidValue(2), true);
assertEquals(test.isValidValue(30), 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_equals2.
public void test_equals2() {
ValueRange a = ValueRange.of(1, 2, 3, 4);
assertEquals(a.equals(ValueRange.of(0, 2, 3, 4)), false);
assertEquals(a.equals(ValueRange.of(1, 3, 3, 4)), false);
assertEquals(a.equals(ValueRange.of(1, 2, 4, 4)), false);
assertEquals(a.equals(ValueRange.of(1, 2, 3, 5)), false);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_of_checkValidValue.
//-----------------------------------------------------------------------
// checkValidValue
//-----------------------------------------------------------------------
@Test(dataProvider = "valid")
public void test_of_checkValidValue(long sMin, long lMin, long sMax, long lMax) {
ValueRange test = ValueRange.of(sMin, lMin, sMax, lMax);
assertEquals(test.checkValidIntValue(sMin, null), sMin);
assertEquals(test.checkValidIntValue(lMin, null), lMin);
assertEquals(test.checkValidIntValue(sMax, null), sMax);
assertEquals(test.checkValidIntValue(lMax, null), lMax);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_of_longlonglong.
//-----------------------------------------------------------------------
// of(long,long,long)
//-----------------------------------------------------------------------
public void test_of_longlonglong() {
ValueRange test = ValueRange.of(1, 28, 31);
assertEquals(test.getMinimum(), 1);
assertEquals(test.getLargestMinimum(), 1);
assertEquals(test.getSmallestMaximum(), 28);
assertEquals(test.getMaximum(), 31);
assertEquals(test.isFixed(), false);
assertEquals(test.isIntValue(), true);
}
use of java.time.temporal.ValueRange in project jdk8u_jdk by JetBrains.
the class TestDateTimeValueRange method test_of_checkValidValueMaxException.
@Test(dataProvider = "valid", expectedExceptions = DateTimeException.class)
public void test_of_checkValidValueMaxException(long sMin, long lMin, long sMax, long lMax) {
ValueRange test = ValueRange.of(sMin, lMin, sMax, lMax);
test.checkValidIntValue(lMax + 1, null);
}
Aggregations