Search in sources :

Example 16 with ValueRange

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

Example 17 with ValueRange

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

Example 18 with ValueRange

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

Example 19 with ValueRange

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

Example 20 with ValueRange

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

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