Search in sources :

Example 21 with ValueRange

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);
}
Also used : ValueRange(java.time.temporal.ValueRange)

Example 22 with ValueRange

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);
}
Also used : ValueRange(java.time.temporal.ValueRange)

Example 23 with ValueRange

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);
}
Also used : ValueRange(java.time.temporal.ValueRange) AbstractTest(test.java.time.AbstractTest) Test(org.testng.annotations.Test)

Example 24 with ValueRange

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);
}
Also used : ValueRange(java.time.temporal.ValueRange)

Example 25 with ValueRange

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);
}
Also used : ValueRange(java.time.temporal.ValueRange) AbstractTest(test.java.time.AbstractTest) Test(org.testng.annotations.Test)

Aggregations

ValueRange (java.time.temporal.ValueRange)28 Test (org.testng.annotations.Test)14 AbstractTest (test.java.time.AbstractTest)6 LocalDate (java.time.LocalDate)3 HijrahChronology (java.time.chrono.HijrahChronology)3 TemporalField (java.time.temporal.TemporalField)3 WeekFields (java.time.temporal.WeekFields)3 AbstractTCKTest (tck.java.time.AbstractTCKTest)3 DateTimeException (java.time.DateTimeException)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 ChronoLocalDate (java.time.chrono.ChronoLocalDate)1 HijrahDate (java.time.chrono.HijrahDate)1 JapaneseDate (java.time.chrono.JapaneseDate)1 JapaneseEra (java.time.chrono.JapaneseEra)1