use of java.time.temporal.TemporalAmount in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_plus_TemporalAmount_zero.
@Test
public void test_plus_TemporalAmount_zero() {
TemporalAmount period = Period.ZERO;
LocalTime t = TEST_12_30_40_987654321.plus(period);
assertEquals(t, TEST_12_30_40_987654321);
}
use of java.time.temporal.TemporalAmount in project jdk8u_jdk by JetBrains.
the class TCKPeriod method test_minus_TemporalAmount_DaysHours.
@Test(expectedExceptions = DateTimeException.class)
public void test_minus_TemporalAmount_DaysHours() {
TemporalAmount amount = new TemporalAmount() {
@Override
public long get(TemporalUnit unit) {
if (unit == DAYS) {
return 1;
} else {
return 2;
}
}
@Override
public List<TemporalUnit> getUnits() {
List<TemporalUnit> list = new ArrayList<>();
list.add(DAYS);
list.add(HOURS);
return list;
}
@Override
public Temporal addTo(Temporal temporal) {
throw new UnsupportedOperationException();
}
@Override
public Temporal subtractFrom(Temporal temporal) {
throw new UnsupportedOperationException();
}
};
pymd(4, 5, 6).minus(amount);
}
use of java.time.temporal.TemporalAmount in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_minus_TemporalAmount_dateNotAllowed.
@Test(expectedExceptions = DateTimeException.class)
public void test_minus_TemporalAmount_dateNotAllowed() {
TemporalAmount period = MockSimplePeriod.of(7, ChronoUnit.MONTHS);
TEST_12_30_40_987654321.minus(period);
}
use of java.time.temporal.TemporalAmount in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_plus_TemporalAmount_positiveHours.
//-----------------------------------------------------------------------
// plus(TemporalAmount)
//-----------------------------------------------------------------------
@Test
public void test_plus_TemporalAmount_positiveHours() {
TemporalAmount period = MockSimplePeriod.of(7, ChronoUnit.HOURS);
LocalTime t = TEST_12_30_40_987654321.plus(period);
assertEquals(t, LocalTime.of(19, 30, 40, 987654321));
}
use of java.time.temporal.TemporalAmount in project jdk8u_jdk by JetBrains.
the class TCKLocalTime method test_plus_TemporalAmount_negativeMinutes.
@Test
public void test_plus_TemporalAmount_negativeMinutes() {
TemporalAmount period = MockSimplePeriod.of(-25, ChronoUnit.MINUTES);
LocalTime t = TEST_12_30_40_987654321.plus(period);
assertEquals(t, LocalTime.of(12, 5, 40, 987654321));
}
Aggregations