Search in sources :

Example 6 with MockSimplePeriod

use of test.java.time.MockSimplePeriod in project jdk8u_jdk by JetBrains.

the class TCKLocalDate method test_plus_Period_invalidTooLarge.

@Test(expectedExceptions = DateTimeException.class)
public void test_plus_Period_invalidTooLarge() {
    MockSimplePeriod period = MockSimplePeriod.of(1, ChronoUnit.YEARS);
    LocalDate.of(Year.MAX_VALUE, 1, 1).plus(period);
}
Also used : MockSimplePeriod(test.java.time.MockSimplePeriod) Test(org.testng.annotations.Test)

Example 7 with MockSimplePeriod

use of test.java.time.MockSimplePeriod in project jdk8u_jdk by JetBrains.

the class TCKLocalDate method test_minus_Period_timeNotAllowed.

@Test(expectedExceptions = DateTimeException.class)
public void test_minus_Period_timeNotAllowed() {
    MockSimplePeriod period = MockSimplePeriod.of(7, ChronoUnit.HOURS);
    TEST_2007_07_15.minus(period);
}
Also used : MockSimplePeriod(test.java.time.MockSimplePeriod) Test(org.testng.annotations.Test)

Example 8 with MockSimplePeriod

use of test.java.time.MockSimplePeriod in project jdk8u_jdk by JetBrains.

the class TCKLocalDate method test_minus_Period_negativeDays.

@Test
public void test_minus_Period_negativeDays() {
    MockSimplePeriod period = MockSimplePeriod.of(-25, ChronoUnit.DAYS);
    LocalDate t = TEST_2007_07_15.minus(period);
    assertEquals(t, LocalDate.of(2007, 8, 9));
}
Also used : LocalDate(java.time.LocalDate) MockSimplePeriod(test.java.time.MockSimplePeriod) Test(org.testng.annotations.Test)

Example 9 with MockSimplePeriod

use of test.java.time.MockSimplePeriod in project jdk8u_jdk by JetBrains.

the class TCKLocalDate method test_minus_Period_positiveMonths.

//-----------------------------------------------------------------------
// minus(Period)
//-----------------------------------------------------------------------
@Test
public void test_minus_Period_positiveMonths() {
    MockSimplePeriod period = MockSimplePeriod.of(7, ChronoUnit.MONTHS);
    LocalDate t = TEST_2007_07_15.minus(period);
    assertEquals(t, LocalDate.of(2006, 12, 15));
}
Also used : LocalDate(java.time.LocalDate) MockSimplePeriod(test.java.time.MockSimplePeriod) Test(org.testng.annotations.Test)

Example 10 with MockSimplePeriod

use of test.java.time.MockSimplePeriod in project jdk8u_jdk by JetBrains.

the class TCKLocalDate method test_plus_Period_invalidTooSmall.

@Test(expectedExceptions = DateTimeException.class)
public void test_plus_Period_invalidTooSmall() {
    MockSimplePeriod period = MockSimplePeriod.of(-1, ChronoUnit.YEARS);
    LocalDate.of(Year.MIN_VALUE, 1, 1).plus(period);
}
Also used : MockSimplePeriod(test.java.time.MockSimplePeriod) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)14 MockSimplePeriod (test.java.time.MockSimplePeriod)14 LocalDate (java.time.LocalDate)4 OffsetDateTime (java.time.OffsetDateTime)2 OffsetTime (java.time.OffsetTime)2