use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class TimeChangesShould method create_LocalTimeChange_instance.
@Test
public void create_LocalTimeChange_instance() {
final LocalTime now = LocalTimes.now();
final LocalTime inFiveHours = LocalTimes.addHours(now, 5);
final LocalTimeChange result = TimeChanges.of(now, inFiveHours);
assertEquals(now, result.getPreviousValue());
assertEquals(inFiveHours, result.getNewValue());
}
use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class ChangesShould method do_not_accept_null_LocalTime_newValue.
@Test(expected = NullPointerException.class)
public void do_not_accept_null_LocalTime_newValue() {
final LocalTime now = LocalTimes.now();
Changes.of(now, null);
}
use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class ChangesShould method create_LocalTimeChange_instance.
@Test
public void create_LocalTimeChange_instance() {
final LocalTime now = LocalTimes.now();
final LocalTime inFiveHours = LocalTimes.addHours(now, 5);
final LocalTimeChange result = Changes.of(now, inFiveHours);
assertEquals(now, result.getPreviousValue());
assertEquals(inFiveHours, result.getNewValue());
}
use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class LocalTimeStringifier method fromString.
@Override
protected LocalTime fromString(String str) {
checkNotNull(str);
final LocalTime time;
try {
time = LocalTimes.parse(str);
} catch (ParseException e) {
throw illegalArgumentWithCauseOf(e);
}
return time;
}
use of io.spine.time.LocalTime in project core-java by SpineEventEngine.
the class OffsetTimesShould method add_minutes.
@Test
public void add_minutes() {
final int minutesDelta = random(1, 300);
final Duration deltaDuration = Durations2.minutes(minutesDelta);
final Timestamp gmtFuture = Timestamps.add(gmtNow, deltaDuration);
final LocalTime expectedFuture = LocalTimes.timeAt(gmtFuture, zoneOffset);
final LocalTime actualFuture = addMinutes(now, minutesDelta).getTime();
assertEquals(expectedFuture, actualFuture);
}
Aggregations