Search in sources :

Example 1 with MockSimplePeriod

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

the class TCKOffsetDateTime method test_plus_Period.

//-----------------------------------------------------------------------
// plus(Period)
//-----------------------------------------------------------------------
@Test
public void test_plus_Period() {
    MockSimplePeriod period = MockSimplePeriod.of(7, ChronoUnit.MONTHS);
    OffsetDateTime t = TEST_2008_6_30_11_30_59_000000500.plus(period);
    assertEquals(t, OffsetDateTime.of(2009, 1, 30, 11, 30, 59, 500, OFFSET_PONE));
}
Also used : OffsetDateTime(java.time.OffsetDateTime) MockSimplePeriod(test.java.time.MockSimplePeriod) Test(org.testng.annotations.Test)

Example 2 with MockSimplePeriod

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

the class TCKLocalDate method test_plus_Period_positiveMonths.

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

Example 3 with MockSimplePeriod

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

the class TCKLocalDate method test_plus_Period_timeNotAllowed.

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

Example 4 with MockSimplePeriod

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

the class TCKLocalDate method test_plus_Period_negativeDays.

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

Example 5 with MockSimplePeriod

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

the class TCKLocalDate method test_minus_Period_invalidTooLarge.

@Test(expectedExceptions = DateTimeException.class)
public void test_minus_Period_invalidTooLarge() {
    MockSimplePeriod period = MockSimplePeriod.of(-1, ChronoUnit.YEARS);
    LocalDate.of(Year.MAX_VALUE, 1, 1).minus(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