Search in sources :

Example 11 with MockSimplePeriod

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

the class TCKLocalDate method test_minus_Period_invalidTooSmall.

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

Example 12 with MockSimplePeriod

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

the class TCKOffsetDateTime method test_minus_Period.

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

Example 13 with MockSimplePeriod

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

the class TCKOffsetTime method test_minus_MinusAdjuster.

//-----------------------------------------------------------------------
// minus(MinusAdjuster)
//-----------------------------------------------------------------------
@Test
public void test_minus_MinusAdjuster() {
    MockSimplePeriod period = MockSimplePeriod.of(7, ChronoUnit.MINUTES);
    OffsetTime t = TEST_11_30_59_500_PONE.minus(period);
    assertEquals(t, OffsetTime.of(11, 23, 59, 500, OFFSET_PONE));
}
Also used : OffsetTime(java.time.OffsetTime) MockSimplePeriod(test.java.time.MockSimplePeriod) Test(org.testng.annotations.Test)

Example 14 with MockSimplePeriod

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

the class TCKOffsetTime method test_plus_PlusAdjuster.

//-----------------------------------------------------------------------
// plus(PlusAdjuster)
//-----------------------------------------------------------------------
@Test
public void test_plus_PlusAdjuster() {
    MockSimplePeriod period = MockSimplePeriod.of(7, ChronoUnit.MINUTES);
    OffsetTime t = TEST_11_30_59_500_PONE.plus(period);
    assertEquals(t, OffsetTime.of(11, 37, 59, 500, OFFSET_PONE));
}
Also used : OffsetTime(java.time.OffsetTime) 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