use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method factory_of_4intsMonth.
//-----------------------------------------------------------------------
// of() factories
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
@Test
public void factory_of_4intsMonth() {
LocalDateTime dateTime = LocalDateTime.of(2007, Month.JULY, 15, 12, 30);
check(dateTime, 2007, 7, 15, 12, 30, 0, 0);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_plusWeeks_symmetry.
@Test(dataProvider = "samplePlusWeeksSymmetry")
public void test_plusWeeks_symmetry(LocalDateTime reference) {
for (int weeks = 0; weeks < 365 * 8; weeks++) {
LocalDateTime t = reference.plusWeeks(weeks).plusWeeks(-weeks);
assertEquals(t, reference);
t = reference.plusWeeks(-weeks).plusWeeks(weeks);
assertEquals(t, reference);
}
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_minusWeeks_negativeOverYears.
@Test
public void test_minusWeeks_negativeOverYears() {
LocalDateTime t = TEST_2007_07_15_12_30_40_987654321.minusWeeks(-104);
check(t, 2009, 7, 12, 12, 30, 40, 987654321);
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method factory_ofEpochSecond_longOffset_beforeEpoch.
@Test
public void factory_ofEpochSecond_longOffset_beforeEpoch() {
LocalDateTime base = LocalDateTime.of(1970, 1, 1, 2, 0, 0, 500);
for (int i = 0; i < 100000; i++) {
LocalDateTime test = LocalDateTime.ofEpochSecond(-i, 500, OFFSET_PTWO);
assertEquals(test, base.minusSeconds(i));
}
}
use of java.time.LocalDateTime in project jdk8u_jdk by JetBrains.
the class TCKLocalDateTime method test_until_convertedType.
@Test
public void test_until_convertedType() {
LocalDateTime start = LocalDateTime.of(2010, 6, 30, 2, 30);
OffsetDateTime end = start.plusDays(2).atOffset(OFFSET_PONE);
assertEquals(start.until(end, DAYS), 2);
}
Aggregations