Search in sources :

Example 16 with LocalTime

use of io.spine.time.LocalTime in project core-java by SpineEventEngine.

the class OffsetTimesShould method subtract_millis.

@Test
public void subtract_millis() {
    final int millisDelta = random(1, 999_999);
    final Duration deltaDuration = Durations.fromMillis(millisDelta);
    final Timestamp gmtPast = Timestamps.subtract(gmtNow, deltaDuration);
    final LocalTime expectedPast = LocalTimes.timeAt(gmtPast, zoneOffset);
    final LocalTime actualPast = subtractMillis(now, millisDelta).getTime();
    assertEquals(expectedPast, actualPast);
}
Also used : LocalTime(io.spine.time.LocalTime) Duration(com.google.protobuf.Duration) Timestamp(com.google.protobuf.Timestamp) Test(org.junit.Test) AbstractZonedTimeTest(io.spine.time.AbstractZonedTimeTest)

Example 17 with LocalTime

use of io.spine.time.LocalTime in project core-java by SpineEventEngine.

the class TimeChangesShould method do_not_accept_null_LocalTime_previousValue.

@Test(expected = NullPointerException.class)
public void do_not_accept_null_LocalTime_previousValue() {
    final LocalTime now = LocalTimes.now();
    TimeChanges.of(null, now);
}
Also used : LocalTime(io.spine.time.LocalTime) Test(org.junit.Test)

Example 18 with LocalTime

use of io.spine.time.LocalTime in project core-java by SpineEventEngine.

the class ChangesShould method do_not_accept_equal_LocalTime_values.

@Test(expected = IllegalArgumentException.class)
public void do_not_accept_equal_LocalTime_values() {
    final LocalTime now = LocalTimes.now();
    Changes.of(now, now);
}
Also used : LocalTime(io.spine.time.LocalTime) Test(org.junit.Test)

Example 19 with LocalTime

use of io.spine.time.LocalTime in project core-java by SpineEventEngine.

the class ChangesShould method do_not_accept_null_LocalTime_previousValue.

@Test(expected = NullPointerException.class)
public void do_not_accept_null_LocalTime_previousValue() {
    final LocalTime now = LocalTimes.now();
    Changes.of(null, now);
}
Also used : LocalTime(io.spine.time.LocalTime) Test(org.junit.Test)

Aggregations

LocalTime (io.spine.time.LocalTime)19 Test (org.junit.Test)18 AbstractZonedTimeTest (io.spine.time.AbstractZonedTimeTest)10 Duration (com.google.protobuf.Duration)8 Timestamp (com.google.protobuf.Timestamp)8 LocalTimeChange (io.spine.time.change.LocalTimeChange)1 ParseException (java.text.ParseException)1 Calendar (java.util.Calendar)1