use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_minusDays_symmetry.
@Test(dataProvider = "sampleMinusDaysSymmetry")
public void test_minusDays_symmetry(LocalDateTime reference) {
for (int days = 0; days < 365 * 8; days++) {
LocalDateTime t = reference.minusDays(days).minusDays(-days);
assertEquals(t, reference);
t = reference.minusDays(-days).minusDays(days);
assertEquals(t, reference);
}
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_get_dates.
//-----------------------------------------------------------------------
// get*()
//-----------------------------------------------------------------------
@Test(dataProvider = "sampleDates")
public void test_get_dates(int y, int m, int d) {
LocalDateTime a = LocalDateTime.of(y, m, d, 12, 30);
assertEquals(a.getYear(), y);
assertEquals(a.getMonth(), Month.of(m));
assertEquals(a.getDayOfMonth(), d);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_comparisons_LocalDateTime.
void test_comparisons_LocalDateTime(LocalDate[] localDates, LocalTime... localTimes) {
LocalDateTime[] localDateTimes = new LocalDateTime[localDates.length * localTimes.length];
int i = 0;
for (LocalDate localDate : localDates) {
for (LocalTime localTime : localTimes) {
localDateTimes[i++] = LocalDateTime.of(localDate, localTime);
}
}
doTest_comparisons_LocalDateTime(localDateTimes);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_getDOY.
@Test(dataProvider = "sampleDates")
public void test_getDOY(int y, int m, int d) {
LocalDateTime a = LocalDateTime.of(y, m, d, 12, 30);
int total = 0;
for (int i = 1; i < m; i++) {
total += Month.of(i).length(isIsoLeap(y));
}
int doy = total + d;
assertEquals(a.getDayOfYear(), doy);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_plusYears_int_adjustDay.
@Test
public void test_plusYears_int_adjustDay() {
LocalDateTime t = createDateMidnight(2008, 2, 29).plusYears(1);
check(t, 2009, 2, 28, 0, 0, 0, 0);
}
Aggregations