use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class TimeChangesShould method do_not_accept_null_LocalTime_newValue.
@Test(expected = NullPointerException.class)
public void do_not_accept_null_LocalTime_newValue() {
final LocalTime now = LocalTimes.now();
TimeChanges.of(now, null);
}
use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class OffsetTimesShould method subtract_minutes.
@Test
public void subtract_minutes() {
final int minutesDelta = random(1, 1024);
final Duration deltaDuration = Durations2.minutes(minutesDelta);
final Timestamp gmtPast = Timestamps.subtract(gmtNow, deltaDuration);
final LocalTime expectedPast = LocalTimes.timeAt(gmtPast, zoneOffset);
final LocalTime actualPast = subtractMinutes(now, minutesDelta).getTime();
assertEquals(expectedPast, actualPast);
}
use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class OffsetTimesShould method create_instance_on_local_time_at_offset.
@Test
public void create_instance_on_local_time_at_offset() {
final LocalTime localTime = generateLocalTime();
final OffsetTime delhiTime = OffsetTimes.of(localTime, zoneOffset);
assertEquals(localTime, delhiTime.getTime());
assertEquals(zoneOffset, delhiTime.getOffset());
}
use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class OffsetTimesShould method add_hours.
/*
* Math with time
*/
@Test
public void add_hours() {
final int hoursDelta = random(1, 100);
final Duration deltaDuration = Durations2.hours(hoursDelta);
final Timestamp gmtFuture = Timestamps.add(gmtNow, deltaDuration);
final LocalTime expectedFuture = LocalTimes.timeAt(gmtFuture, zoneOffset);
final LocalTime actualFuture = addHours(now, hoursDelta).getTime();
assertEquals(expectedFuture, actualFuture);
}
use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class TimeChangesShould method do_not_accept_equal_LocalTime_values.
@Test(expected = IllegalArgumentException.class)
public void do_not_accept_equal_LocalTime_values() {
final LocalTime now = LocalTimes.now();
TimeChanges.of(now, now);
}
Aggregations