use of java.time.ZonedDateTime in project jetty.project by eclipse.
the class RolloverFileOutputStreamTest method assertSequence.
private void assertSequence(ZonedDateTime midnight, Object[][] expected) {
ZonedDateTime nextEvent = midnight;
for (int i = 0; i < expected.length; i++) {
long lastMs = nextEvent.toInstant().toEpochMilli();
nextEvent = RolloverFileOutputStream.nextMidnight(nextEvent);
assertThat("Next Event", toString(nextEvent), is(expected[i][0]));
long duration = (nextEvent.toInstant().toEpochMilli() - lastMs);
assertThat("Duration to next event", duration, is((long) expected[i][1]));
}
}
use of java.time.ZonedDateTime in project jetty.project by eclipse.
the class RolloverFileOutputStreamTest method testMidnightRolloverCalc_Sydney_DST_End.
@Test
public void testMidnightRolloverCalc_Sydney_DST_End() {
ZoneId zone = toZoneId("Australia/Sydney");
ZonedDateTime initialDate = toDateTime("2016.04.02-11:22:33.0 AM AEDT", zone);
ZonedDateTime midnight = RolloverFileOutputStream.toMidnight(initialDate, zone);
assertThat("Midnight", toString(midnight), is("2016.04.02-12:00:00.0 AM AEDT"));
Object[][] expected = { { "2016.04.03-12:00:00.0 AM AEDT", 86_400_000L }, // The long day
{ "2016.04.04-12:00:00.0 AM AEST", 90_000_000L }, { "2016.04.05-12:00:00.0 AM AEST", 86_400_000L }, { "2016.04.06-12:00:00.0 AM AEST", 86_400_000L }, { "2016.04.07-12:00:00.0 AM AEST", 86_400_000L } };
assertSequence(midnight, expected);
}
use of java.time.ZonedDateTime in project jetty.project by eclipse.
the class RolloverFileOutputStreamTest method testMidnightRolloverCalc_PST_DST_Start.
@Test
public void testMidnightRolloverCalc_PST_DST_Start() {
ZoneId zone = toZoneId("PST");
ZonedDateTime initialDate = toDateTime("2016.03.11-01:23:45.0 PM PST", zone);
ZonedDateTime midnight = RolloverFileOutputStream.toMidnight(initialDate, zone);
assertThat("Midnight", toString(midnight), is("2016.03.11-12:00:00.0 AM PST"));
Object[][] expected = { { "2016.03.12-12:00:00.0 AM PST", 86_400_000L }, { "2016.03.13-12:00:00.0 AM PST", 86_400_000L }, // the short day
{ "2016.03.14-12:00:00.0 AM PDT", 82_800_000L }, { "2016.03.15-12:00:00.0 AM PDT", 86_400_000L }, { "2016.03.16-12:00:00.0 AM PDT", 86_400_000L } };
assertSequence(midnight, expected);
}
use of java.time.ZonedDateTime in project jetty.project by eclipse.
the class RolloverFileOutputStreamTest method testMidnightRolloverCalc_PST_DST_End.
@Test
public void testMidnightRolloverCalc_PST_DST_End() {
ZoneId zone = toZoneId("PST");
ZonedDateTime initialDate = toDateTime("2016.11.04-11:22:33.0 AM PDT", zone);
ZonedDateTime midnight = RolloverFileOutputStream.toMidnight(initialDate, zone);
assertThat("Midnight", toString(midnight), is("2016.11.04-12:00:00.0 AM PDT"));
Object[][] expected = { { "2016.11.05-12:00:00.0 AM PDT", 86_400_000L }, { "2016.11.06-12:00:00.0 AM PDT", 86_400_000L }, // the long day
{ "2016.11.07-12:00:00.0 AM PST", 90_000_000L }, { "2016.11.08-12:00:00.0 AM PST", 86_400_000L }, { "2016.11.09-12:00:00.0 AM PST", 86_400_000L } };
assertSequence(midnight, expected);
}
use of java.time.ZonedDateTime in project hibernate-orm by hibernate.
the class ZonedDateTimeTest method testZoneDateTimeWithUTCZoneOffset.
@Test
public void testZoneDateTimeWithUTCZoneOffset() {
final ZonedDateTime expectedStartDate = ZonedDateTime.of(1, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC);
saveZoneDateTimeEventWithStartDate(expectedStartDate);
checkSavedZonedDateTimeIsEqual(expectedStartDate);
compareSavedZonedDateTimeWith(expectedStartDate);
}
Aggregations