use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_plusNanos_fromZero.
@Test(dataProvider = "plusNanos_fromZero")
public void test_plusNanos_fromZero(long nanoseconds, LocalDate date, int hour, int min, int sec, int nanos) {
LocalDateTime base = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.MIDNIGHT);
LocalDateTime t = base.plusNanos(nanoseconds);
assertEquals(date, t.toLocalDate());
assertEquals(hour, t.getHour());
assertEquals(min, t.getMinute());
assertEquals(sec, t.getSecond());
assertEquals(nanos, t.getNano());
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_plus_longTemporalUnit_negativeDays.
@Test
public void test_plus_longTemporalUnit_negativeDays() {
LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plus(-25, ChronoUnit.DAYS);
assertEquals(t, LocalDateTime.of(2007, 6, 20, 12, 30, 40, 987654321));
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_minusYears_int_normal.
//-----------------------------------------------------------------------
// minusYears()
//-----------------------------------------------------------------------
@Test
public void test_minusYears_int_normal() {
LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusYears(1);
check(t, 2006, 7, 15, 12, 30, 40, 987654321);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_plusWeeks_overLeapYears.
@Test
public void test_plusWeeks_overLeapYears() {
LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.plusYears(-1).plusWeeks(104);
check(t, 2008, 7, 12, 12, 30, 40, 987654321);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKZonedDateTime method test_minusMinutes_minutes.
@Test
public void test_minusMinutes_minutes() {
LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0);
ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100);
ZonedDateTime test = base.minusMinutes(30);
assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100));
}
Aggregations